3

We have a reasonably heavy AJAX site at http://www.beckworthemporium.com/index.php?option=com_rsappt_pro2&view=booking_screen_gad&Itemid=58

Currently each page request uses 5/6 AJAX requests to return the various pieces of the page and are fairly mySQL intensive. We'll be due a slow increase in traffic up until Christmas. Would we see any benefit of using keep alive?

Jeepstone
  • 2,591
  • 5
  • 22
  • 38

2 Answers2

8

How much traffic are you talking about? If you plan to use Keep-alive then you might want to ensure you have enough memory and lower the keep alive timeout to the lowest possible otherwise if you end up getting a lot of traffic it could hurt you. Sites with excessive traffic usually have keep alive disabled.

Also take a look and read http keep-alive in the modern age

I ran a report on your page at http://www.webpagetest.org/result/121008_TX_KB9/

As for your AJAX calls, I would improve those whether you use keep-alive or not. I would cache the responses. For example after you run your mysql queries and generate your output, cache it to disk for a few hours (or longer if possible) and then on subsequent calls pull the data from disk if it has not expired. This will save a bunch and speed up things overall.

Also if you're concerned about speed, I would use image sprites for a lot of your image resources. I notice some of your images are placeholders and are 100% transparent, consider using css only for those. This will reduce your overall requests dramatically.

I would also enable mod_expires and add some Expires headers. For an example htaccess file using these and more good practice features look at: https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess

EDIT

Jeepstone, I would recommend you don't enable keep-alive and maybe use a CDN and Parallelize your resources. You may also want to look at your database config. For example MySQL has low max connections and you might want to optimize slow queries, connection timeouts and ensure that you do not use any persistent connections.

Also if you're really concerned about the state of your web stack you can test it right now instead of finding out the problems down the line when there are a lot more real customers knocking. I'm talking about stress/load testing.

Community
  • 1
  • 1
Anthony Hatzopoulos
  • 10,437
  • 2
  • 40
  • 57
  • Current traffic is approx 250 users per day, but this will steadily increase to 1000 per day until Christmas. Bandwidth is about 6gb per month, increasing to approx 20gb over Christmas. It's difficult to cache them as they can can quickly when there are a lot of bookings going through. Our biggest problem at the moment is MaxClients. The server is a little under powered and we've maxed out on ram at 8gb. We're currently looking at our options but wanted to improve the site as much as possible. – Jeepstone Oct 12 '12 at 13:46
  • @Jeepstone I've added an edit above because it didn't fit in the comment box. – Anthony Hatzopoulos Oct 12 '12 at 16:42
  • Thanks Anthony, can I ask why you don't recommend keepalive based on what you've seen? I think the MySQL queries probably need a little tweaking though. – Jeepstone Oct 15 '12 at 07:54
  • Find a way to make your responses cachablem, then you can tackle caching separately (caching on client, reverse proxy, or CDN). But making them cachable is the first step. – David Roussel Oct 15 '12 at 10:20
  • @Jeepstone I recommend you not use it because your currently having memory issues and your box is under powered. With keepalive you would likely quadruple active connections and thus the ram needed for apache. That is more true if you use php and not FastCGI. If you move to FastCGI you could lower the memory footprint per php/apache threads for the connections. David Roussel's suggestion is a good one as well, start with improving your cacheability – Anthony Hatzopoulos Oct 15 '12 at 16:05
1

There are two big issues on large sites: concurrent connections and latency. Looking at your Christmas numbers, I don't think your site is large. Therefore I would not see a big benefit from using Keep-Alive. Enabling Keep-Alive might increase the number of idle connections which would not help.

I would go the route of load testing your website, see what is the biggest bottleneck and fix it. Iterate by finding the biggest bottleneck and improve. You might find in your instance that the database is the main culprit. There are free load testing tools out there, or semi-free: VS Test Suite offers free for MSDN subscribers up to 250 virtual real concurrent users, which is more than you need.

sainiuc
  • 1,697
  • 11
  • 13
  • You could also look at using tools like Chrome PageSpeed and find out what can be improved. A 'quick win' suggested by PageSpeed would be to set a cache expiry date of at least 7 days for the ~25 static served objects you have. – sainiuc Oct 15 '12 at 14:23
  • https://developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fwww.beckworthemporium.com_2Findex.php_3Foption_3Dcom__rsappt__pro2_26view_3Dbooking__screen__gad_26Itemid_3D58&mobile=false&rule=LeverageBrowserCaching – sainiuc Oct 15 '12 at 14:24