WebFaction
Community site: login faq

I'm on a shared 256 plan and I was wondering if there would be any advantage in terms of speed if I was running my own instance of nginx and PHP with PHP-FM + APC (Advanced PHP Cache).

Right now I'm serving static resources through the shared nginx and employ W3TC to do disk caching and other optimizations.

asked 30 Oct '12, 18:18

L De Leo
26410
accept rate: 0%

I was going to ask this exact same question. IN a similar vein:

My main consideration is pure performance (how fast can it serve a page), but obviously the ability to scale is a good thing to plan ahead for.

I currently use fast-cgi (3 x 64mb), w3tc, and nginx serving static content.

Nginx plus php-fpm seems to be the most popular/trendy way to run wordpress. It seems though that since everything has to run through the main nginx you are just adding more cruft if you roll your own. However, we can't get APC/etc...

The basic setup we are going for is Nginx serves static (we have that with the shared instance), PHP-FPM serves PHP (which supports APC all by itself). Is it possible to get shared nginx to work with our instance of php-fpm?

I'd really like to do some profiling to determine where the bottlenecks are, but here are some other things I've thought of:

Run your own dedicated mysql server. This could even be done on its own plan, to maximize performance. MySQL doesn't support cgroup style partitioning as far as I know, so in certain cases this could be beneficial.

I've read about a few folks who've used Redis as a frontline cache for wordpress with a bit of custom code:

http://www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/

Or just search google for "wordpress redis"

Thoughts?

(13 Dec '12, 19:00) stoolio

Your assessment is correct -- running a private mysql is a good way to improve performance, but only on a CentOS 6 server, because these servers already have cgroups enabled to help partition your own processes and guarantee resources on a per-user basis. In particular:

  • Under cgroups (active on all CentOS 6 servers), all users get equal priority to system resources
  • Mysql is one user on the machine, under which the system-wide mysql instance runs
  • Your queries under the system-wide mysql would be competing with the other queries for mysql's resource space
  • By having a private database, the db runs under your user instead of 'mysql', so you get as many resources for your private mysql as the shared mysql gets, total.
  • Unlike previously, higher database usage by other users cannot choke your private instance
  • You are not limited to 30 simultaneous connections, as the private mysql instance has no connection limit

Then, it turns out, that if you're already on a CentOS 6 server and cgroups is enabled, then you can also improve performance by running your own PHP stack (be it Nginx or Apache), since your processes will not compete with other Apache processes for resources.

So, in short, none of these things will directly improve performance in and of themselves on a CentOS 5 machine, especially because you're going through an Nginx front-end anyway, But on a CentOS 6 machine with Cgroups there could be a nice performance gain.

(13 Dec '12, 19:37) ryans ♦♦

I'd say you're unlikely to find much of a speed improvement, if any, running via your own Nginx instance, mainly because the connection to that instance would still be proxied through the main Nginx instance. Caching, as you've already implemented, is really the best kind of optimization you can implement in addition to static serving of files.

permanent link

answered 30 Oct '12, 18:55

waynek
4254
accept rate: 27%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×244
×186
×9

question asked: 30 Oct '12, 18:18

question was seen: 3,217 times

last updated: 13 Dec '12, 19:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM