You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dominik Bruhn <do...@dbruhn.de> on 2006/04/13 01:23:05 UTC
Switching from PHP to Java/Velocity, Performance?
Hy,
I currently got a online-community running on a PHP-Bulletin-Board-Software. I
didn't write the software myself but I modified it over the time so the code
grew and became quite unreadable, hard to understand and also slow.
Some data for the site:
300Users online at the same time
30661 visitors per day
10GB Traffic per day
The site is currently running on two servers, one for the dynamic PHP-Scripts
and one for the Database (MySQL) and the static content.
I was thinking about a complete rewrite for a long time and now I started to
plan it more detailed. As I have used Velocity and Java for another (but
quite small) project this was what first came into my mind. I also hoped for
some speed increases from a Java-Application due to the fact that is possible
to cache the Data-Base Data and save Queries to the DB. I'm also thinking
about the time when there might be more than one server needed for the site
(due to increasing visitors).
My PHP and Java knowledeges are about equal, but I have never done such a big
project in Java (neither in PHP) and so i'm searching for help.
On my search through the internet I found a webpage where they told that
friendster (really big site) switched from java to PHP due to performance.
This made me think about my decision.
http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html
I fear programming the whole Website in Java and then recognizing that its
much to slow for this purpose. Thats why I write to this mailinglist. Are
there any people who made a similar step from php to java and can tell about
performance gains or looses.
Can anybody else tell me where there are differences and how the influence the
performance.
Thanks
TO
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by jian chen <ch...@gmail.com>.
Sorry about the beyond.com info. That is not a java site.
The following are some prominent sites that uses java:
www.become.com
(especially this article about their using java:
http://java.sun.com/developer/technicalArticles/WebServices/become/)
www.nextag.com
Cheers,
Jian
On 4/12/06, jian chen <ch...@gmail.com> wrote:
>
> HI, Dominik,
>
> I have written a java based application for the real estate industry using
> Velocity, and people just love it.
>
> The nice thing about Java is that, it is a strongly typed language and
> compiled, so, many errors could be caught in the compilation phase. Plus, I
> like the java design much better.
>
> To be frank, PHP is just a hack, it is not a real programming language.
> Yahoo bought the PHP developer, but what I heard from the yahoo people
> themselves, is pretty much negative comments on using PHP.
>
> PHP is a dirty-quick solution, but to be really scalable, you need to use
> a true programming language.
>
> There are lot of sites that uses java, for example, www.indeed.com,
> www.beyond.com, just give you an example. Those sites are big, high volume
> sites. I heard Altavisa uses WebMacro, which is the predecessor of Velocity
> as well.
>
> I am always ambitous enough to build a google type of search site using
> java...
>
> Jian
> Lead Developer
> Seattle Lighting
>
>
> On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
> >
> > Hy Will,
> > thanks to your response. My question was not only concerning Velocity
> > but also
> > about Java in General in Comparison to PHP. I hope that there are some
> > Developers who have user Java and Velocity in realy huge sites.
> >
> > Thanks
> > Dominik
> >
> >
> >
> >
> > Am Thursday 13 April 2006 01:33 schrieb Will Glass-Husain:
> > > Hi Dominik,
> > >
> > > Wow, that's a busy site.
> > >
> > > The short answer is that writing a high performance application is
> > > mostly about architecture and only partially about language. If you
> > > read the pages and pages of comments on that famous post, the
> > > intelligent comments mostly boil down to that response. Caching is
> > > critical, (for both database queries and page generation), as is good
> > > database design.
> > >
> > > Velocity is unlikely to be a significant part of your bottleneck as
> > > performance with template caching turned on is quite fast.
> > >
> > > WILL
> > >
> > > On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
> > > > Hy,
> > > > I currently got a online-community running on a
> > > > PHP-Bulletin-Board-Software. I didn't write the software myself but
> > I
> > > > modified it over the time so the code grew and became quite
> > unreadable,
> > > > hard to understand and also slow.
> > > >
> > > > Some data for the site:
> > > > 300Users online at the same time
> > > > 30661 visitors per day
> > > > 10GB Traffic per day
> > > >
> > > > The site is currently running on two servers, one for the dynamic
> > > > PHP-Scripts and one for the Database (MySQL) and the static content.
> >
> > > >
> > > > I was thinking about a complete rewrite for a long time and now I
> > started
> > > > to plan it more detailed. As I have used Velocity and Java for
> > another
> > > > (but quite small) project this was what first came into my mind. I
> > also
> > > > hoped for some speed increases from a Java-Application due to the
> > fact
> > > > that is possible to cache the Data-Base Data and save Queries to the
> > DB.
> > > > I'm also thinking about the time when there might be more than one
> > server
> > > > needed for the site (due to increasing visitors).
> > > > My PHP and Java knowledeges are about equal, but I have never done
> > such a
> > > > big project in Java (neither in PHP) and so i'm searching for help.
> > > >
> > > > On my search through the internet I found a webpage where they told
> > that
> > > > friendster (really big site) switched from java to PHP due to
> > > > performance. This made me think about my decision.
> > > >
> > http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html
> > > >
> > > > I fear programming the whole Website in Java and then recognizing
> > that
> > > > its much to slow for this purpose. Thats why I write to this
> > mailinglist.
> > > > Are there any people who made a similar step from php to java and
> > can
> > > > tell about performance gains or looses.
> > > >
> > > > Can anybody else tell me where there are differences and how the
> > > > influence the performance.
> > > >
> > > > Thanks
> > > > TO
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > velocity-user-help@jakarta.apache.org
> > >
> > > --
> > > Forio Business Simulations
> > >
> > > Will Glass-Husain
> > > wglass@forio.com
> > > www.forio.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
Re: Switching from PHP to Java/Velocity, Performance?
Posted by jian chen <ch...@gmail.com>.
HI, Dominik,
I have written a java based application for the real estate industry using
Velocity, and people just love it.
The nice thing about Java is that, it is a strongly typed language and
compiled, so, many errors could be caught in the compilation phase. Plus, I
like the java design much better.
To be frank, PHP is just a hack, it is not a real programming language.
Yahoo bought the PHP developer, but what I heard from the yahoo people
themselves, is pretty much negative comments on using PHP.
PHP is a dirty-quick solution, but to be really scalable, you need to use a
true programming language.
There are lot of sites that uses java, for example, www.indeed.com,
www.beyond.com, just give you an example. Those sites are big, high volume
sites. I heard Altavisa uses WebMacro, which is the predecessor of Velocity
as well.
I am always ambitous enough to build a google type of search site using
java...
Jian
Lead Developer
Seattle Lighting
On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
>
> Hy Will,
> thanks to your response. My question was not only concerning Velocity but
> also
> about Java in General in Comparison to PHP. I hope that there are some
> Developers who have user Java and Velocity in realy huge sites.
>
> Thanks
> Dominik
>
>
>
>
> Am Thursday 13 April 2006 01:33 schrieb Will Glass-Husain:
> > Hi Dominik,
> >
> > Wow, that's a busy site.
> >
> > The short answer is that writing a high performance application is
> > mostly about architecture and only partially about language. If you
> > read the pages and pages of comments on that famous post, the
> > intelligent comments mostly boil down to that response. Caching is
> > critical, (for both database queries and page generation), as is good
> > database design.
> >
> > Velocity is unlikely to be a significant part of your bottleneck as
> > performance with template caching turned on is quite fast.
> >
> > WILL
> >
> > On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
> > > Hy,
> > > I currently got a online-community running on a
> > > PHP-Bulletin-Board-Software. I didn't write the software myself but I
> > > modified it over the time so the code grew and became quite
> unreadable,
> > > hard to understand and also slow.
> > >
> > > Some data for the site:
> > > 300Users online at the same time
> > > 30661 visitors per day
> > > 10GB Traffic per day
> > >
> > > The site is currently running on two servers, one for the dynamic
> > > PHP-Scripts and one for the Database (MySQL) and the static content.
> > >
> > > I was thinking about a complete rewrite for a long time and now I
> started
> > > to plan it more detailed. As I have used Velocity and Java for another
> > > (but quite small) project this was what first came into my mind. I
> also
> > > hoped for some speed increases from a Java-Application due to the fact
> > > that is possible to cache the Data-Base Data and save Queries to the
> DB.
> > > I'm also thinking about the time when there might be more than one
> server
> > > needed for the site (due to increasing visitors).
> > > My PHP and Java knowledeges are about equal, but I have never done
> such a
> > > big project in Java (neither in PHP) and so i'm searching for help.
> > >
> > > On my search through the internet I found a webpage where they told
> that
> > > friendster (really big site) switched from java to PHP due to
> > > performance. This made me think about my decision.
> > >
> http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html
> > >
> > > I fear programming the whole Website in Java and then recognizing that
> > > its much to slow for this purpose. Thats why I write to this
> mailinglist.
> > > Are there any people who made a similar step from php to java and can
> > > tell about performance gains or looses.
> > >
> > > Can anybody else tell me where there are differences and how the
> > > influence the performance.
> > >
> > > Thanks
> > > TO
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> > --
> > Forio Business Simulations
> >
> > Will Glass-Husain
> > wglass@forio.com
> > www.forio.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Dominik Bruhn <do...@dbruhn.de>.
Hy,
> Nowadays, every good database
> will already have a built-in caching mechanism.
so do you think that caching on the servlet-side is not needed and I should
leave this task to the Database-Engine? This would simplify the whole task
because I don't have to keep the caches on each server in sync.
BUT: Why is everbyody talking about caching? I think altough the
Database-Servers might cache some data I still have to keep some of it in my
servlets, at least those parts who are needed very often and change very
seldom.
How do the others think about this?
Thanks
Dominik
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Ben <be...@pcguy.org>.
Just speaking from experience, don't want to start any server wars here:)
Had a high traffic site running on Tomcat and then switched to Resin and
noticed the improvement, also mentioned this to somebody and he gave me the
3x figure, guess the only way to know for sure for any specific
site/application is to run benchmarks in both tomcat and resin and see which
one works best for you.
----- Original Message -----
From: "Bill Rishel" <il...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Sunday, April 16, 2006 9:28 PM
Subject: Re: Switching from PHP to Java/Velocity, Performance?
I found this, which seems to contradict superiority claims
for Resin:
http://raibledesigns.com/page/rd?anchor=resin_slower_than_tomcat_fails
Bill Rishel
On 4/16/06, Andrew Mason <sl...@gmail.com> wrote:
>
> Is resin that much faster ?
> On Sunday 16 April 2006 1:56 am, Ben wrote:
> > Just a thought: is there a specific reason you're using Tomcat and not
> > Resin? Resin is much faster than Tomcat, with some people saying it's 3
> > times as fast, so might be a quick and easy way for you to improve
> > performance.
> >
> > ----- Original Message -----
> > From: "Dominik Bruhn" <do...@dbruhn.de>
> > To: <ve...@jakarta.apache.org>
> > Sent: Thursday, April 13, 2006 5:43 AM
> > Subject: Re: Switching from PHP to Java/Velocity, Performance?
> >
> > > Hy,
> > > thanks for all responses. As I have written PHP-Scripts for years I
> know
> > > the
> > > differences between writing a PHP-Script and writing a Java-Programm:
> > > Java forces you to write "better" code when PHP lefts the possibility
> to
> > > write "ugly" code. I also know the advandage of PHP: You can develop
> fast
> > > and
> > > don't need much knowledge to start.
> > >
> > > My plans were to Use a VelocityViewServlet and Velocity-Templates. In
> > > between
> > > a small layer for abstraction and Page-Handling and Permissions. As
> > > Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> > > advandages in it. I don't want to use Struts because I think its
> useless
> > > for
> > > me. The whole Servlet runs on a Tomcat-Container.
> > >
> > > When talking about the ability to cluster the Servlet in future I
> thought
> > > about the following solution: I two or more Tomcat's on different
> > > servers. Then I put a Webserver with Proxy-Support in front which
> > > distributes the Requests over the Tomcats. This seems a quite simple
> and
> > > fast solution. What
> > > are the point I have to think of when realising such a system? Where
> are
> > > the
> > > facts where the people tell that PHP ist better when using clustering?
> I
> > > cant
> > > understand this!
> > >
> > >
> > > Thanks
> > > Dominik
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Bill Rishel <il...@gmail.com>.
I found this, which seems to contradict superiority claims
for Resin:
http://raibledesigns.com/page/rd?anchor=resin_slower_than_tomcat_fails
Bill Rishel
On 4/16/06, Andrew Mason <sl...@gmail.com> wrote:
>
> Is resin that much faster ?
> On Sunday 16 April 2006 1:56 am, Ben wrote:
> > Just a thought: is there a specific reason you're using Tomcat and not
> > Resin? Resin is much faster than Tomcat, with some people saying it's 3
> > times as fast, so might be a quick and easy way for you to improve
> > performance.
> >
> > ----- Original Message -----
> > From: "Dominik Bruhn" <do...@dbruhn.de>
> > To: <ve...@jakarta.apache.org>
> > Sent: Thursday, April 13, 2006 5:43 AM
> > Subject: Re: Switching from PHP to Java/Velocity, Performance?
> >
> > > Hy,
> > > thanks for all responses. As I have written PHP-Scripts for years I
> know
> > > the
> > > differences between writing a PHP-Script and writing a Java-Programm:
> > > Java forces you to write "better" code when PHP lefts the possibility
> to
> > > write "ugly" code. I also know the advandage of PHP: You can develop
> fast
> > > and
> > > don't need much knowledge to start.
> > >
> > > My plans were to Use a VelocityViewServlet and Velocity-Templates. In
> > > between
> > > a small layer for abstraction and Page-Handling and Permissions. As
> > > Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> > > advandages in it. I don't want to use Struts because I think its
> useless
> > > for
> > > me. The whole Servlet runs on a Tomcat-Container.
> > >
> > > When talking about the ability to cluster the Servlet in future I
> thought
> > > about the following solution: I two or more Tomcat's on different
> > > servers. Then I put a Webserver with Proxy-Support in front which
> > > distributes the Requests over the Tomcats. This seems a quite simple
> and
> > > fast solution. What
> > > are the point I have to think of when realising such a system? Where
> are
> > > the
> > > facts where the people tell that PHP ist better when using clustering?
> I
> > > cant
> > > understand this!
> > >
> > >
> > > Thanks
> > > Dominik
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Andrew Mason <sl...@gmail.com>.
Is resin that much faster ?
On Sunday 16 April 2006 1:56 am, Ben wrote:
> Just a thought: is there a specific reason you're using Tomcat and not
> Resin? Resin is much faster than Tomcat, with some people saying it's 3
> times as fast, so might be a quick and easy way for you to improve
> performance.
>
> ----- Original Message -----
> From: "Dominik Bruhn" <do...@dbruhn.de>
> To: <ve...@jakarta.apache.org>
> Sent: Thursday, April 13, 2006 5:43 AM
> Subject: Re: Switching from PHP to Java/Velocity, Performance?
>
> > Hy,
> > thanks for all responses. As I have written PHP-Scripts for years I know
> > the
> > differences between writing a PHP-Script and writing a Java-Programm:
> > Java forces you to write "better" code when PHP lefts the possibility to
> > write "ugly" code. I also know the advandage of PHP: You can develop fast
> > and
> > don't need much knowledge to start.
> >
> > My plans were to Use a VelocityViewServlet and Velocity-Templates. In
> > between
> > a small layer for abstraction and Page-Handling and Permissions. As
> > Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> > advandages in it. I don't want to use Struts because I think its useless
> > for
> > me. The whole Servlet runs on a Tomcat-Container.
> >
> > When talking about the ability to cluster the Servlet in future I thought
> > about the following solution: I two or more Tomcat's on different
> > servers. Then I put a Webserver with Proxy-Support in front which
> > distributes the Requests over the Tomcats. This seems a quite simple and
> > fast solution. What
> > are the point I have to think of when realising such a system? Where are
> > the
> > facts where the people tell that PHP ist better when using clustering? I
> > cant
> > understand this!
> >
> >
> > Thanks
> > Dominik
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Florin Vancea <fv...@maxiq.ro>.
----- Original Message -----
From: "Claude Brisson" <cl...@renegat.net>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, April 13, 2006 4:57 PM
Subject: Re: Switching from PHP to Java/Velocity, Performance?
> Le jeudi 13 avril 2006 à 16:37 +0300, Florin Vancea a écrit :
> > > You can have a look at Velosurf. It's a small database access layer
that
> > > won't induce any bottleneck by it owns. Nowadays, every good database
> > > will already have a built-in caching mechanism.
> >
> > Yes, true, but at the end of the day it's network roundtrips and
overhead
> > that kills you.
>
> Depends. The pipes between the front computer and the database are
> usually not a problem.
It's not the width of the pipe, it's the latency, multiplied by the number
of queries to complete a particular task.
> Plus, very often, an overhead is made of very few
> specific queries and my strategy is then to introduce a specific cache,
> rather than cache everything.
I agree, caching should be as specific as possible. Both in terms of "what"
and of "for how long".
>
> Le jeudi 13 avril 2006 à 15:41 +0200, Dominik Bruhn a écrit :
> > Hy,
> > > Nowadays, every good database
> > > will already have a built-in caching mechanism.
> > so do you think that caching on the servlet-side is not needed and I
should
> > leave this task to the Database-Engine? This would simplify the whole
task
> > because I don't have to keep the caches on each server in sync.
>
> That's my point.
>
> >
> > BUT: Why is everbyody talking about caching? I think altough the
> > Database-Servers might cache some data I still have to keep some of it
in my
> > servlets, at least those parts who are needed very often and change very
> > seldom.
>
> Exactly. Velosurf has a caching option that you can set to true for the
most
> needed entities.
>
I do not know Velosurf (and I'll correct that once I press "send" on this
one) but it seems like a persistence layer, too, tailored for a different
set of needs than Hibernate.
>
> Claude
Nice talk, really, but maybe we've drifted too far from the list topic. I'll
try to keep myself from continuing :)
Have a nice day!
Florin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Claude Brisson <cl...@renegat.net>.
Le jeudi 13 avril 2006 à 16:37 +0300, Florin Vancea a écrit :
> > You can have a look at Velosurf. It's a small database access layer that
> > won't induce any bottleneck by it owns. Nowadays, every good database
> > will already have a built-in caching mechanism.
>
> Yes, true, but at the end of the day it's network roundtrips and overhead
> that kills you.
Depends. The pipes between the front computer and the database are
usually not a problem. Plus, very often, an overhead is made of very few
specific queries and my strategy is then to introduce a specific cache,
rather than cache everything.
Le jeudi 13 avril 2006 à 15:41 +0200, Dominik Bruhn a écrit :
> Hy,
> > Nowadays, every good database
> > will already have a built-in caching mechanism.
> so do you think that caching on the servlet-side is not needed and I should
> leave this task to the Database-Engine? This would simplify the whole task
> because I don't have to keep the caches on each server in sync.
That's my point.
>
> BUT: Why is everbyody talking about caching? I think altough the
> Database-Servers might cache some data I still have to keep some of it in my
> servlets, at least those parts who are needed very often and change very
> seldom.
Exactly. Velosurf has a caching option that you can set to true for the most
needed entities.
Claude
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Florin Vancea <fv...@maxiq.ro>.
----- Original Message -----
From: "Claude Brisson" <cl...@renegat.net>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, April 13, 2006 4:28 PM
Subject: Re: Switching from PHP to Java/Velocity, Performance?
> Le jeudi 13 avril 2006 à 11:43 +0200, Dominik Bruhn a écrit :
> > My plans were to Use a VelocityViewServlet and Velocity-Templates. In
between
> > a small layer for abstraction and Page-Handling and Permissions. As
> > Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> > advandages in it.
>
> I agree.
>
> Le jeudi 13 avril 2006 à 14:40 +0300, Florin Vancea a écrit :
> > Of course JDBC would work, but as soon as the complexity grows, you may
want
> > a layer that shields you from it. It's the same "better"/"ugly" issue.
>
> True, but Hibernate seems overkill for this task.
>
> You can have a look at Velosurf. It's a small database access layer that
> won't induce any bottleneck by it owns. Nowadays, every good database
> will already have a built-in caching mechanism.
Yes, true, but at the end of the day it's network roundtrips and overhead
that kills you.
>
> Claude
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Claude Brisson <cl...@renegat.net>.
Le jeudi 13 avril 2006 à 11:43 +0200, Dominik Bruhn a écrit :
> My plans were to Use a VelocityViewServlet and Velocity-Templates. In between
> a small layer for abstraction and Page-Handling and Permissions. As
> Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> advandages in it.
I agree.
Le jeudi 13 avril 2006 à 14:40 +0300, Florin Vancea a écrit :
> Of course JDBC would work, but as soon as the complexity grows, you may want
> a layer that shields you from it. It's the same "better"/"ugly" issue.
True, but Hibernate seems overkill for this task.
You can have a look at Velosurf. It's a small database access layer that
won't induce any bottleneck by it owns. Nowadays, every good database
will already have a built-in caching mechanism.
Claude
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: OT: Re: Switching from PHP to Java/Velocity, Performance?
Posted by Dominik Bruhn <do...@dbruhn.de>.
Hy,
im not sure when I'll need the second Webserver but the site grows and grows
and there will be one point when the current setup wont be enough. The
question is: when.
From your thought I think I can imagine why they tell you can cluster PHP
better: As every request is running on its own there is no problem in keeping
the data between the servers in sync because they all got the same and only
data-backend.
For example I planed to cache all the boards and their permissions in the
right order in a hashmap in the servlet. So I load it once which takes some
time and then access it direct from a variable without a single Data-Query.
At some time I have to change the data in the cash (last thread created,
count of posts). When there is only one instance on one server this is not a
problem, i simply change the values. But, if there are many servers I have to
send a message to all servers: "Hey, something change, change the Counter to
xxx". I don't know how to do this and It might cost some performance.
Of course I load this HashMap uppon every request, but then all the saving
from caching would have been gone.
Thanks
TO
Am Thursday 13 April 2006 13:40 schrieb Florin Vancea:
> Hi Dominik,
>
> Just some thoughts:
>
> - as said many times before here (on the list) properly used Velocity is
> fast enough to be the least of your worries. The main advantage comes from
> the clean separation between the logic and the presentation.
>
> - to us, using Hibernate amounted (in the long run) to clearer code and
> tighter logic due to the higher abstractisation of the entities
> manipulated. Of course JDBC would work, but as soon as the complexity
> grows, you may want a layer that shields you from it. It's the same
> "better"/"ugly" issue.
>
> - clustering will bring you issues with session portability and will impact
> usable caching policies. If you need transactions then it can get really
> ugly. See below.
>
> - session portability: I recall seeing somewhere a solution that claimed to
> achieve good performance by serializing the common objects (like session
> objects) in a single MySQL database and retrieving them each time when
> needed by a PHP processor (where there may be several PHP processors to
> carry the load). Tomcat is capable of working in clusters (and I believe
> that it also serializes session objects to do that) but passing them around
> between cluster members may not be via a database (which should be a good
> thing).
>
> - caching: Caching ability (and good cache tuning) can be a great help on
> performance when using Hibernate. And very easy to setup, too. However,
> when clustered, proper caching is more difficult and any implementation may
> drastically reduce the efficiency of caching, so you're back to square one.
>
> - transactions: Handling transactions (even explicit ones) are easy or
> rather easy on a single-noded-Hibernate. If going clustered _everything_
> gets more complicated.
>
> In short: are you really sure you'll need clustering? Wouldn't just a good
> tune-up and a good machine do the trick?
>
> Please note that I never got to set up a real clustered system - our apps
> are luckily not that heavy loaded - so take my opinions with a grain of
> salt.
>
> Florin
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Ben <be...@pcguy.org>.
Just a thought: is there a specific reason you're using Tomcat and not
Resin? Resin is much faster than Tomcat, with some people saying it's 3
times as fast, so might be a quick and easy way for you to improve
performance.
----- Original Message -----
From: "Dominik Bruhn" <do...@dbruhn.de>
To: <ve...@jakarta.apache.org>
Sent: Thursday, April 13, 2006 5:43 AM
Subject: Re: Switching from PHP to Java/Velocity, Performance?
> Hy,
> thanks for all responses. As I have written PHP-Scripts for years I know
> the
> differences between writing a PHP-Script and writing a Java-Programm: Java
> forces you to write "better" code when PHP lefts the possibility to
> write "ugly" code. I also know the advandage of PHP: You can develop fast
> and
> don't need much knowledge to start.
>
> My plans were to Use a VelocityViewServlet and Velocity-Templates. In
> between
> a small layer for abstraction and Page-Handling and Permissions. As
> Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> advandages in it. I don't want to use Struts because I think its useless
> for
> me. The whole Servlet runs on a Tomcat-Container.
>
> When talking about the ability to cluster the Servlet in future I thought
> about the following solution: I two or more Tomcat's on different servers.
> Then I put a Webserver with Proxy-Support in front which distributes the
> Requests over the Tomcats. This seems a quite simple and fast solution.
> What
> are the point I have to think of when realising such a system? Where are
> the
> facts where the people tell that PHP ist better when using clustering? I
> cant
> understand this!
>
>
> Thanks
> Dominik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
OT: Re: Switching from PHP to Java/Velocity, Performance?
Posted by Florin Vancea <fv...@maxiq.ro>.
Hi Dominik,
Just some thoughts:
- as said many times before here (on the list) properly used Velocity is
fast enough to be the least of your worries. The main advantage comes from
the clean separation between the logic and the presentation.
- to us, using Hibernate amounted (in the long run) to clearer code and
tighter logic due to the higher abstractisation of the entities manipulated.
Of course JDBC would work, but as soon as the complexity grows, you may want
a layer that shields you from it. It's the same "better"/"ugly" issue.
- clustering will bring you issues with session portability and will impact
usable caching policies. If you need transactions then it can get really
ugly. See below.
- session portability: I recall seeing somewhere a solution that claimed to
achieve good performance by serializing the common objects (like session
objects) in a single MySQL database and retrieving them each time when
needed by a PHP processor (where there may be several PHP processors to
carry the load). Tomcat is capable of working in clusters (and I believe
that it also serializes session objects to do that) but passing them around
between cluster members may not be via a database (which should be a good
thing).
- caching: Caching ability (and good cache tuning) can be a great help on
performance when using Hibernate. And very easy to setup, too. However, when
clustered, proper caching is more difficult and any implementation may
drastically reduce the efficiency of caching, so you're back to square one.
- transactions: Handling transactions (even explicit ones) are easy or
rather easy on a single-noded-Hibernate. If going clustered _everything_
gets more complicated.
In short: are you really sure you'll need clustering? Wouldn't just a good
tune-up and a good machine do the trick?
Please note that I never got to set up a real clustered system - our apps
are luckily not that heavy loaded - so take my opinions with a grain of
salt.
Florin
----- Original Message -----
From: "Dominik Bruhn" <do...@dbruhn.de>
To: <ve...@jakarta.apache.org>
Sent: Thursday, April 13, 2006 12:43 PM
Subject: Re: Switching from PHP to Java/Velocity, Performance?
> Hy,
> thanks for all responses. As I have written PHP-Scripts for years I know
the
> differences between writing a PHP-Script and writing a Java-Programm: Java
> forces you to write "better" code when PHP lefts the possibility to
> write "ugly" code. I also know the advandage of PHP: You can develop fast
and
> don't need much knowledge to start.
>
> My plans were to Use a VelocityViewServlet and Velocity-Templates. In
between
> a small layer for abstraction and Page-Handling and Permissions. As
> Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
> advandages in it. I don't want to use Struts because I think its useless
for
> me. The whole Servlet runs on a Tomcat-Container.
>
> When talking about the ability to cluster the Servlet in future I thought
> about the following solution: I two or more Tomcat's on different servers.
> Then I put a Webserver with Proxy-Support in front which distributes the
> Requests over the Tomcats. This seems a quite simple and fast solution.
What
> are the point I have to think of when realising such a system? Where are
the
> facts where the people tell that PHP ist better when using clustering? I
cant
> understand this!
>
>
> Thanks
> Dominik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Dominik Bruhn <do...@dbruhn.de>.
Hy,
thanks for all responses. As I have written PHP-Scripts for years I know the
differences between writing a PHP-Script and writing a Java-Programm: Java
forces you to write "better" code when PHP lefts the possibility to
write "ugly" code. I also know the advandage of PHP: You can develop fast and
don't need much knowledge to start.
My plans were to Use a VelocityViewServlet and Velocity-Templates. In between
a small layer for abstraction and Page-Handling and Permissions. As
Database-Layer I use JDBC. I tired Hibernate but I haven't seen any
advandages in it. I don't want to use Struts because I think its useless for
me. The whole Servlet runs on a Tomcat-Container.
When talking about the ability to cluster the Servlet in future I thought
about the following solution: I two or more Tomcat's on different servers.
Then I put a Webserver with Proxy-Support in front which distributes the
Requests over the Tomcats. This seems a quite simple and fast solution. What
are the point I have to think of when realising such a system? Where are the
facts where the people tell that PHP ist better when using clustering? I cant
understand this!
Thanks
Dominik
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Will Glass-Husain <wg...@forio.com>.
Oh, no. Here come the religious arguments. Although you'll likely
find more Java than PHP programmers on this list!
To be fair, although I'm a Java programmer I attended a compelling
presentation on designing scalable apps with PHP. (Taught by Cal
Henderson of Flickr). So, I'm wary of blanket statements condemning
scripting languages or PHP.
http://www.carsonworkshops.com/dev/henderson/20JUN2005_photos.html
Anyone have good practical resources/articles on scalable web app
design to point Dominik towards?
WILL
On 4/12/06, Peter Harrison <pe...@nbn.co.nz> wrote:
> Dominik Bruhn wrote:
> > Hy Will,
> > thanks to your response. My question was not only concerning Velocity but also
> > about Java in General in Comparison to PHP. I hope that there are some
> > Developers who have user Java and Velocity in realy huge sites.
> >
>
> You must also consider complexity. If you have a site which is simple
> then PHP will probably be fine, even under heavy load. However, if your
> application is complex then Java shows its mettle.
>
> You *can* write nice PHP code, but it requires a disciplined developer.
> You can also write horrible Java code, although its less permissive
> about what it allows at compile time (strong typing).
>
> The point is that each language has its role, and I think blanket
> statements like "PHP is not a language" are not helpful. Python for
> example is a great language, and we have used it several times to
> develop quick solutions that would have been substantially more
> difficult in Java.
>
> However, with the infrastructure around Java/Struts/Velocity the actual
> code you have to write is greatly reduced, and whats left is simplified.
> For web apps Java/Tomcat/Struts/Velocity remains a credible and
> effective solution.
>
> The downside to Java I feel is a pretty long learning curve compared to
> other languages. It is certainly more verbose, and has quite a few
> elements that make life complex.
>
> PHP and Python on the other hand have not developed the same
> infrastructure to date, although if you want a CMS there are many
> options that will be a good start.
>
> As for performance, I must agree that performance is a question of
> architecture and complexity. Complex applications will be slower because
> they need more DB time and more CPU. The best way to handle this is - as
> a previous poster said, keep everything cached where possible, hit the
> db the least possible, and keep the architecture open so you can deploy
> multiple web servers as part of a cluster.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
--
Forio Business Simulations
Will Glass-Husain
wglass@forio.com
www.forio.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Peter Harrison <pe...@nbn.co.nz>.
Dominik Bruhn wrote:
> Hy Will,
> thanks to your response. My question was not only concerning Velocity but also
> about Java in General in Comparison to PHP. I hope that there are some
> Developers who have user Java and Velocity in realy huge sites.
>
You must also consider complexity. If you have a site which is simple
then PHP will probably be fine, even under heavy load. However, if your
application is complex then Java shows its mettle.
You *can* write nice PHP code, but it requires a disciplined developer.
You can also write horrible Java code, although its less permissive
about what it allows at compile time (strong typing).
The point is that each language has its role, and I think blanket
statements like "PHP is not a language" are not helpful. Python for
example is a great language, and we have used it several times to
develop quick solutions that would have been substantially more
difficult in Java.
However, with the infrastructure around Java/Struts/Velocity the actual
code you have to write is greatly reduced, and whats left is simplified.
For web apps Java/Tomcat/Struts/Velocity remains a credible and
effective solution.
The downside to Java I feel is a pretty long learning curve compared to
other languages. It is certainly more verbose, and has quite a few
elements that make life complex.
PHP and Python on the other hand have not developed the same
infrastructure to date, although if you want a CMS there are many
options that will be a good start.
As for performance, I must agree that performance is a question of
architecture and complexity. Complex applications will be slower because
they need more DB time and more CPU. The best way to handle this is - as
a previous poster said, keep everything cached where possible, hit the
db the least possible, and keep the architecture open so you can deploy
multiple web servers as part of a cluster.
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Dominik Bruhn <do...@dbruhn.de>.
Hy Will,
thanks to your response. My question was not only concerning Velocity but also
about Java in General in Comparison to PHP. I hope that there are some
Developers who have user Java and Velocity in realy huge sites.
Thanks
Dominik
Am Thursday 13 April 2006 01:33 schrieb Will Glass-Husain:
> Hi Dominik,
>
> Wow, that's a busy site.
>
> The short answer is that writing a high performance application is
> mostly about architecture and only partially about language. If you
> read the pages and pages of comments on that famous post, the
> intelligent comments mostly boil down to that response. Caching is
> critical, (for both database queries and page generation), as is good
> database design.
>
> Velocity is unlikely to be a significant part of your bottleneck as
> performance with template caching turned on is quite fast.
>
> WILL
>
> On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
> > Hy,
> > I currently got a online-community running on a
> > PHP-Bulletin-Board-Software. I didn't write the software myself but I
> > modified it over the time so the code grew and became quite unreadable,
> > hard to understand and also slow.
> >
> > Some data for the site:
> > 300Users online at the same time
> > 30661 visitors per day
> > 10GB Traffic per day
> >
> > The site is currently running on two servers, one for the dynamic
> > PHP-Scripts and one for the Database (MySQL) and the static content.
> >
> > I was thinking about a complete rewrite for a long time and now I started
> > to plan it more detailed. As I have used Velocity and Java for another
> > (but quite small) project this was what first came into my mind. I also
> > hoped for some speed increases from a Java-Application due to the fact
> > that is possible to cache the Data-Base Data and save Queries to the DB.
> > I'm also thinking about the time when there might be more than one server
> > needed for the site (due to increasing visitors).
> > My PHP and Java knowledeges are about equal, but I have never done such a
> > big project in Java (neither in PHP) and so i'm searching for help.
> >
> > On my search through the internet I found a webpage where they told that
> > friendster (really big site) switched from java to PHP due to
> > performance. This made me think about my decision.
> > http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html
> >
> > I fear programming the whole Website in Java and then recognizing that
> > its much to slow for this purpose. Thats why I write to this mailinglist.
> > Are there any people who made a similar step from php to java and can
> > tell about performance gains or looses.
> >
> > Can anybody else tell me where there are differences and how the
> > influence the performance.
> >
> > Thanks
> > TO
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> wglass@forio.com
> www.forio.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Switching from PHP to Java/Velocity, Performance?
Posted by Will Glass-Husain <wg...@forio.com>.
Hi Dominik,
Wow, that's a busy site.
The short answer is that writing a high performance application is
mostly about architecture and only partially about language. If you
read the pages and pages of comments on that famous post, the
intelligent comments mostly boil down to that response. Caching is
critical, (for both database queries and page generation), as is good
database design.
Velocity is unlikely to be a significant part of your bottleneck as
performance with template caching turned on is quite fast.
WILL
On 4/12/06, Dominik Bruhn <do...@dbruhn.de> wrote:
> Hy,
> I currently got a online-community running on a PHP-Bulletin-Board-Software. I
> didn't write the software myself but I modified it over the time so the code
> grew and became quite unreadable, hard to understand and also slow.
>
> Some data for the site:
> 300Users online at the same time
> 30661 visitors per day
> 10GB Traffic per day
>
> The site is currently running on two servers, one for the dynamic PHP-Scripts
> and one for the Database (MySQL) and the static content.
>
> I was thinking about a complete rewrite for a long time and now I started to
> plan it more detailed. As I have used Velocity and Java for another (but
> quite small) project this was what first came into my mind. I also hoped for
> some speed increases from a Java-Application due to the fact that is possible
> to cache the Data-Base Data and save Queries to the DB. I'm also thinking
> about the time when there might be more than one server needed for the site
> (due to increasing visitors).
> My PHP and Java knowledeges are about equal, but I have never done such a big
> project in Java (neither in PHP) and so i'm searching for help.
>
> On my search through the internet I found a webpage where they told that
> friendster (really big site) switched from java to PHP due to performance.
> This made me think about my decision.
> http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html
>
> I fear programming the whole Website in Java and then recognizing that its
> much to slow for this purpose. Thats why I write to this mailinglist. Are
> there any people who made a similar step from php to java and can tell about
> performance gains or looses.
>
> Can anybody else tell me where there are differences and how the influence the
> performance.
>
> Thanks
> TO
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
--
Forio Business Simulations
Will Glass-Husain
wglass@forio.com
www.forio.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org