Re: Fastest method to serve dynamic java content
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Keeny, On 2/16/2009 5:15 AM, keenny wrote: > I'm currently working on a system that must be able to serve thousands of > requests per sec. The requests/responses contains only small amounts of data > (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using > java to generate the responses. Static content are served separately (by > lighttpd). I was just wondering if anybody has any opinions as to how this > can be done most effectively (highest throughput, low cpu consumption etc). > Some alternatives being: > > lighttpd -> mod_proxy -> tomcat -> application code > lighttpd -> fastcgi -> application code > tomcat -> application code > asyncweb/mina -> application code I'm not sure how "fastcgi" would run your Java application code. I think this all depends upon the types of requests you expect to get. lighttpd is presumably "faster than Tomcat" for static content. Tomcat itself is pretty fast as a static HTML server, so you might not want to discount your 3rd option there. If you don't expect a lot in the way of static content requests, then you should probably eliminate the extra processing that will have to be done with all your dynamic requests being forwarded through mod_proxy or some other communication channel. Apache mina doesn't appear to be an HTTP server. I'm sure you could re-build all that HTTP infrastructure on top of mina, but is it worth it? The same can be said of the Servlet API. If you're starting from scratch, the Servlet API might not be much of a concern. If you're looking to re-deploy an existing application, you might want to consider other options (such as mina). I think the use of XMLHttpRequest is going to be your limiting factor because they you /must/ use HTTP for communication. Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmZ6N0ACgkQ9CaO5/Lv0PCTygCghkzi6Yfqkm4w4wL3RqoqpO/7 oiEAnjvJokCgtr6ggMofCtdQRQhkfA/w =V1bm -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fastest method to serve dynamic java content
Not in this case, but the requirements this poses on the back-end system is similar. As explained above, the latency will be high, but so must the throughput. awarnier wrote: > > keenny wrote: >> Hello all, >> >> I'm currently working on a system that must be able to serve thousands of >> requests per sec. The requests/responses contains only small amounts of >> data >> (ajax XMLHTTPRequests) and are not long lived (connection keep). > > Whenever I see a description like the above, my immediate thought is of > some drop-down box a la Google, with suggested values that change while > the user is typing. Is that the kind of thing you`re talking about ? > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > -- View this message in context: http://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22035537.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fastest method to serve dynamic java content
awarnier wrote: > > keenny wrote: >> Hello all, >> >> I'm currently working on a system that must be able to serve thousands of >> requests per sec. The requests/responses contains only small amounts of >> data >> (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm >> using >> java to generate the responses. Static content are served separately (by >> lighttpd). I was just wondering if anybody has any opinions as to how >> this >> can be done most effectively (highest throughput, low cpu consumption >> etc). >> Some alternatives being: >> >> lighttpd -> mod_proxy -> tomcat -> application code >> lighttpd -> fastcgi -> application code >> tomcat -> application code >> asyncweb/mina -> application code > > I would think that a key factor not mentioned above is : once your java > application gets the actual request, how long does it take it to > generate the response (however small the response actually is) ? > > To be more explicit : you mention thousands of requests per second. To > server these, if generating each response takes 1 second, you would need > thousands of processes in order just to keep up. > There is also a question of bandwidth of course, even for small amounts > of data, thousands of requests amount to quite a bit, so to speak. > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > Good points. Generating responses does take some time (several hundred ms), but this is mainly because it involves calling other services in the cluster (not cpu-bound that is). To avoid thousands of sleeping threads asynchronous i/o will be used (i understand tomcat 6 has support for this?). Therefore the overall throughput will be high, but latency not that good (however latency is not an issue due to the application characteristics). An added equirement for my scenario is therefore that async handeling of requests must be used. -- View this message in context: http://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22035479.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Fastest method to serve dynamic java content
> From: keenny [mailto:kee...@start.no] > I was just wondering if anybody has any opinions > as to how this > can be done most effectively (highest throughput, low cpu > consumption etc). > Some alternatives being: > > lighttpd -> mod_proxy -> tomcat -> application code Lots of moving parts. There has to be a better solution! > lighttpd -> fastcgi -> application code Depends on how the CGI is implemented. Not one for a Tomcat list :-). > tomcat -> application code Surprisingly fast, even for static content. Depending on your mix of static and dynamic content, this may use less CPU than the combination of lighttpd and mod_proxy as there are fewer moving parts per request. > asyncweb/mina -> application code Never used, so don't know! Do the AJAX requests have to be served from the same port as the static content, or can they come from a different port? If a different port is acceptable, you might want to try using lighttpd on port 80 to serve the static content, and Tomcat or another servlet engine on a different port (8080?) to serve the AJAX requests. But check the benchmarks on Tomcat before you introduce two pieces of software into the mix. You might be pleasantly surprised! - Peter - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fastest method to serve dynamic java content
keenny wrote: Hello all, I'm currently working on a system that must be able to serve thousands of requests per sec. The requests/responses contains only small amounts of data (ajax XMLHTTPRequests) and are not long lived (connection keep). Whenever I see a description like the above, my immediate thought is of some drop-down box a la Google, with suggested values that change while the user is typing. Is that the kind of thing you`re talking about ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fastest method to serve dynamic java content
keenny wrote: Hello all, I'm currently working on a system that must be able to serve thousands of requests per sec. The requests/responses contains only small amounts of data (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using java to generate the responses. Static content are served separately (by lighttpd). I was just wondering if anybody has any opinions as to how this can be done most effectively (highest throughput, low cpu consumption etc). Some alternatives being: lighttpd -> mod_proxy -> tomcat -> application code lighttpd -> fastcgi -> application code tomcat -> application code asyncweb/mina -> application code I would think that a key factor not mentioned above is : once your java application gets the actual request, how long does it take it to generate the response (however small the response actually is) ? To be more explicit : you mention thousands of requests per second. To server these, if generating each response takes 1 second, you would need thousands of processes in order just to keep up. There is also a question of bandwidth of course, even for small amounts of data, thousands of requests amount to quite a bit, so to speak. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Fastest method to serve dynamic java content
Hello all, I'm currently working on a system that must be able to serve thousands of requests per sec. The requests/responses contains only small amounts of data (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using java to generate the responses. Static content are served separately (by lighttpd). I was just wondering if anybody has any opinions as to how this can be done most effectively (highest throughput, low cpu consumption etc). Some alternatives being: lighttpd -> mod_proxy -> tomcat -> application code lighttpd -> fastcgi -> application code tomcat -> application code asyncweb/mina -> application code -- View this message in context: http://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22034617.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org