Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Feb 23, 2012 12:59 pm 
Offline
Senior Newbie

Joined: Thu Feb 23, 2012 12:51 pm
Posts: 12
Hi all,

I'm preparing a server to host a relatively busy website (100k pageviews/month and 25k unique/month on average but expect more the week we relaunch).

Got a Linode 1024, spent a few hours setting up everything:

- nginx
- php-fpm
- mysql
- APC
- memcache
- pressflow (drupal)

all good and a simple ab -n 40000 -c 1000 http://localhost/ give me around 7000 requests/sec

then I thought "let's prepare varnish as well", did that and run the same ab test and only got 2000 reqs/sec...

everything else is the same and in fact if I now run ab -n 40000 -c 1000 http://localhost:8080/ (going directly to nginx) I still get my 7000 reqs/sec.

All the settings are default ones, no cutting edge stuff.

Any idea? Cheers


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 1:18 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Looks like you're already using pressflow, but you could take a look at:

https://www.varnish-cache.org/trac/wiki ... hAndDrupal

There are also some articles on best practices:

http://kristianlyng.wordpress.com/2010/ ... practices/

Varnish can provide benefits when running on the same machine as the other software, but it's really meant to have a dedicated box.


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 1:22 pm 
Offline
Senior Newbie

Joined: Thu Feb 23, 2012 12:51 pm
Posts: 12
Thanks Guspaz, indeed I'm already using it and I'm sure I have work to do on settings and configuration.

But at the moment I've just installed pressflow (and the needed modules for Drupal) and haven't created any content therefore I don't think that should have much of an impact: the few existing pages (the front created by pressflow) has been the same all day and should be in cache.

Thanks again


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 1:24 pm 
Offline
Senior Newbie

Joined: Thu Feb 23, 2012 12:51 pm
Posts: 12
but I am using 32-bit and I see from you second linke that that's not ideal.

Thanks again


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 2:22 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
100k pageviews/month = 3k pageviews/day = one pageview per 30 seconds on average.

Even at 100 times that figure, putting anything in front of nginx is unlikely to perform better than nginx on its own, especially if everything is running on the same box.

Switching to 64-bit just for the sake of Varnish is likely to incur penalties in other areas of your software stack. For example, Drupal will probably consume a lot more RAM on 64-bit, leaving less RAM for Varnish to juggle with.

Also try varying the concurrency (-c) of your benchmark. Your software stack and configuration may not be optimized for that particular concurrency level.


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 2:33 pm 
Offline
Senior Newbie

Joined: Thu Feb 23, 2012 12:51 pm
Posts: 12
hybinet wrote:
100k pageviews/month = 3k pageviews/day = one pageview per 30 seconds on average.

Even at 100 times that figure, putting anything in front of nginx is unlikely to perform better than nginx on its own, especially if everything is running on the same box.


agreed, wanted to experiment while the box is still private but will definitely not put varnish when it goes live


hybinet wrote:
Switching to 64-bit just for the sake of Varnish is likely to incur penalties in other areas of your software stack. For example, Drupal will probably consume a lot more RAM on 64-bit, leaving less RAM for Varnish to juggle with.


will never go to 64-but unless it's needed and it's not here

hybinet wrote:
Also try varying the concurrency (-c) of your benchmark. Your software stack and configuration may not be optimized for that particular concurrency level.


thanks!


Top
   
 Post subject:
PostPosted: Thu Feb 23, 2012 3:29 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Varnish recommends 64-bit because it relies on virtual memory to perform disk caching; it does no cache management itself (not between different cache levels, anyhow), it simply shoves everything in RAM and lets the OS decide what should be in RAM or on disc. If you're running a 32-bit OS, you're not going to be able to cache more than 3GB of data with Varnish, in RAM or on disk.

Normally, on a linode, we recommend little or no swap space, because it almost never makes sense to dig into swap. Caker says you should have none, I say you should have a bit just to get the never-used stuff out of RAM.

Varnish, on the other hand, isn't like that at all. For a dedicated Varnish machine, it might make sense to have a 1024MB linode with a 20GB swap partition, depending on the workload. But with a 32-bit OS, you'd basically be limited to a 2GB disk cache.


Top
   
PostPosted: Thu Jun 21, 2012 3:50 pm 
Offline
Newbie

Joined: Wed Jun 20, 2012 5:48 pm
Posts: 2
Are you sure your ab results are accurate? 7000 requests per second seems really really fast, I would expect varnish could respond like that, but not the rest of the stack.

If nginx or php-fpm crap out then you're just receiving error responses at a really high rate (ab reports these as non-2xx responses or something like that). Check also the size on the response is right, what ab reports compared to what you see on your browser.

Also varnish has a utility like top that reports cache hits in real time so you can monitor and see if it's hitting at all. I've had trouble ab, drupal, and varnish, where the ab requests just pass through varnish without hitting the cache - then varnish just could add a little overhead to the responses and slow things down a bit...


Top
   
 Post subject: Re:
PostPosted: Thu Jun 21, 2012 5:21 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
hybinet wrote:

Even at 100 times that figure, putting anything in front of nginx is unlikely to perform better than nginx on its own, especially if everything is running on the same box.


Yep.

I've got a 1GB node running Apache behind nginx. 10M hits per month, out of which some 2M hit Apache. nginx doesn't even break a sweat. CPU use in average 80% (out of 400%) mostly because of very poor SQL and each hit has to scan and sort through tens of thousands of unindexed joins (MySQL localhost). Unfortunately I can't change that, I just run the show for a client.


Top
   
PostPosted: Fri Jun 22, 2012 3:16 am 
Offline
Newbie

Joined: Wed Jun 20, 2012 12:23 am
Posts: 4
You might also want to try using -k as a lot of the requests you get will be on an already active connection (assuming images, css, js on the page). Your main focus should still be on PHP/MySQL as nginx/varnish are definitely not the limiting factor (unless you are caching every page with nginx/varnish).


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group