Results 1 to 17 of 17
  1. #1
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252

    Apache & MySql Tuning for Cloud server with 4GB & 2 cores

    Hi!

    I just received my new cloud server. It comes with 4GB ram (ddr3) and 2 cores (each equivalent of one Amazon ECU, which should correspond to 400 passmarks).

    I'm planning on running two Wordpress sites on the server. for now, I'm sticking to a standard Apache & MySQL setup.

    The server image is Centos 5.5 64bit.

    Any recommended settings for Apache and MySQL?

    I'm not interested in running Nginx as of now, but am planning on installing an opcode cache (APC).


    I'm looking forward to receiving your suggestions and inputs on obtaining the optimal settings for this setup.


    <<< Signatures need to be set up in your profile. >>>
    Last edited by SoftWareRevue; 04-18-2011 at 10:52 AM.

  2. #2
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252

    Initial my.cnf settings

    [mysqld]
    skip-name-resolve
    thread_concurrency=2
    max_connections=500
    max_user_connections=8
    key_buffer=256M
    myisam_sort_buffer_size=64M
    join_buffer_size=1M
    read_buffer_size=2M
    sort_buffer_size=2M
    table_cache=1024
    thread_cache_size=64
    interactive_timeout=20
    wait_timeout=15
    connect_timeout=8
    max_allowed_packet=128M
    max_connect_errors=10
    query_cache_limit=1M
    query_cache_size=64M
    query_cache_type=1
    flush
    flush_time=3600
    long_query_time = 10
    safe-show-database
    collation_server=utf8_unicode_ci
    character_set_server=utf8

    [mysqld_safe]
    open_files_limit=8192

    [mysqldump]
    quick
    max_allowed_packet=16M

    [myisamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M

    [mysqlhotcopy]
    interactive-timeoutd

  3. #3
    Join Date
    Nov 2009
    Posts
    544
    bergholt;

    Question, I'm just curious. Why did you choose to use only one server to run both sites on?

    It seems that the optimal settings would depend on the load presented by a given application and this could be wildly different for each site since (presumably) the software configuration and user base will be different for each site.

    Given the flexibility of today's "cloud environment", would it not be better to run the sites in their own instance that can be configured and scaled to meet the individual needs?

  4. #4
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    @srfremman


    Good question(s):


    1) Limitation of operating System overhead: Centos takes up a specific amount of base ressources. Running two instances would dobule this amount.

    2) Both sites run on the same platform (Wordpress)

    3) Maintenance issues -- one server to monitor, backup, tune

    If splitting up, it'd make more sense to me to keep the MySQL server on a separate instance / in a separate environment.

    4) Userbase and demography (and thus load patterns) should be close to identical.

    I'm ny no means an expert Linux sys admin, so I'd be happy to be corrected should my calcucations/reason show wrong.



    <<< Signatures need to be set up in your profile. >>>
    Last edited by SoftWareRevue; 04-18-2011 at 10:52 AM.

  5. #5
    Join Date
    Nov 2009
    Location
    Cincinnati
    Posts
    1,583
    crank your open-files-limit to 20000, 8000 is hardly enough if you have more than 50 database.

    Why would you not run nginx? It's 1000x faster than apache and easy to configure.

    Use the REMI repo, it has nginx, php-fpm and php-apc available.

    http://blog.famillecollet.com/pages/Config-en
    'Ripcord'ing is the only way!

  6. #6
    Join Date
    Nov 2009
    Posts
    544
    Yes, but (there is always a but)...

    1) Resources are resources, if a given amount of resources are needed to run a project optimally then so be it. The "cloud" should be alleviating the "limited resource" issue.

    2) Well, calling WordPress a platform is a bit of a stretch but the configuration and needs of each installation can be wildly different.

    Are you considering the "multi-user" capabilities of WordPress (prior to v3.0 this was called WordPress MU - the current designation escapes me)?

    3) The maintenance issues need to be automated. Again, this would include only what is needed to run the project optimally, no more, no less.

    A separate MySQL instance used by both sites? Having the same configuration for both sites could be the problem here also. Maybe another resource issue.

    4) If the user base and demography are the same, what is the point of two sites?

    It could be that each site will provide different information, media types and levels of user interactivity which would mean different configurations and different infrastructure needs.

    Just some thoughts and opinions but without stats on the number of users, user interactivity, media types served, etc... it makes the question of optimal setup a moving target.

    WordPress presents its own problems when it comes to database configuration (reads - posts and media being served - are very random while writes - commenting and posting are sequential and block reads until they are done, causing some potentially deep i/o request queue issues.
    Last edited by srfreeman; 04-17-2011 at 12:07 PM.

  7. #7
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by srfreeman View Post
    Yes, but (there is always a but)...

    1) Resources are resources, if a given amount of resources are needed to run a project optimally then so be it. The "cloud" should be alleviating the "limited resource" issue.

    2) Well, calling WordPress a platform is a bit of a stretch but the configuration and needs of each installation can be wildly different.

    Are you considering the "multi-user" capabilities of WordPress (prior to v3.0 this was called WordPress MU - the current designation escapes me)?

    3) The maintenance issues need to be automated. Again, this would include only what is needed to run the project optimally, no more, no less.

    A separate MySQL instance used by both sites? Having the same configuration for both sites could be the problem here also. Maybe another resource issue.

    4) If the user base and demography are the same, what is the point of two sites?

    It could be that each site will provide different information, media types and levels of user interactivity which would mean different configurations and different infrastructure needs.

    Just some thoughts and opinions but without stats on the number of users, user interactivity, media types served, etc... it makes the question of optimal setup a moving target.

    WordPress presents its own problems when it comes to database configuration (reads - posts and media being served - are very random while writes - commenting and posting are sequential and block reads until they are done, causing some potentially deep i/o request queue issues.
    1) Don't agree. A basic installation of Centos, Apache, MySQL, PHP requies a specific amount of resources to run optimally. If price was no concern, yes I'd split up the project to run on separate servers. But economy and price is an issue.

    2) That's true, but for my purposes the latest version of Wordpress running 7-10 plugins can be considered a platform from a structural point of view. No Wordpress MU.

    3) As I stated in my first post, I'm not an experienced Linux system administrator. If that'd been the case, I'd not need to ask for advice re. the perfect setup here...

    4) Userbase is the same in terms of size, not specific individuals.

    5) What kind of information -- and in which format -- do you need to recommend optimal MySQL & Apache settings?

    98% of traffic is generated by reads. 2% by postings and comments.


    <<< Signatures need to be set up in your profile. >>>
    Last edited by SoftWareRevue; 04-18-2011 at 10:52 AM.

  8. #8
    Join Date
    Nov 2009
    Posts
    544
    Quote Originally Posted by bergholt View Post
    1) Don't agree. A basic installation of Centos, Apache, MySQL, PHP requies a specific amount of resources to run optimally. If price was no concern, yes I'd split up the project to run on separate servers. But economy and price is an issue.

    2) That's true, but for my purposes the latest version of Wordpress running 7-10 plugins can be considered a platform from a structural point of view. No Wordpress MU.

    3) As I stated in my first post, I'm not an experienced Linux system administrator. If that'd been the case, I'd not need to ask for advice re. the perfect setup here...

    4) Userbase is the same in terms of size, not specific individuals.

    5) What kind of information -- and in which format -- do you need to recommend optimal MySQL & Apache settings?

    98% of traffic is generated by reads. 2% by postings and comments.


    <<< Signatures need to be set up in your profile. >>>
    Ok, since this is not a business issue, merely a price driven academic exercise, you will have to realize that any recommendation will be simply an approximation based on information you provide.

    I would start with the fact that the default settings in Centos, Apache, MySQL and PHP have been worked out over time to cover the average shared setup administered by the uninitiated. You may not want to do anything.

    It seems to me that for anyone to guess at any optimizations over the defaults would require information like:

    A list of plug-ins, widgets, etc... and their respective configuration that are added to each installation.

    An explanation of what each post will include. What type of media and the respective weight will be served to the user. Media storage, local, remote or inside the database.

    An explanation of user interactivity. What they can do. What they are expected to do. Time of day that each site gets the heaviest user interactivity.

    Configuration of the infrastructure these installations are to be hosted on. Is there a SAN? Is distributed storage being used and if so what type? Any storage system setup information would be helpful.

    Realize that if putting this on a cloud based infrastructure has cost any more than another type - you have wasted money. You will gain nothing with this configuration.
    Last edited by SoftWareRevue; 04-18-2011 at 10:52 AM.

  9. #9
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by srfreeman View Post
    Ok, since this is not a business issue, merely a price driven academic exercise, you will have to realize that any recommendation will be simply an approximation based on information you provide.

    I would start with the fact that the default settings in Centos, Apache, MySQL and PHP have been worked out over time to cover the average shared setup administered by the uninitiated. You may not want to do anything.

    It seems to me that for anyone to guess at any optimizations over the defaults would require information like:

    A list of plug-ins, widgets, etc... and their respective configuration that are added to each installation.

    An explanation of what each post will include. What type of media and the respective weight will be served to the user. Media storage, local, remote or inside the database.

    An explanation of user interactivity. What they can do. What they are expected to do. Time of day that each site gets the heaviest user interactivity.

    Configuration of the infrastructure these installations are to be hosted on. Is there a SAN? Is distributed storage being used and if so what type? Any storage system setup information would be helpful.

    Realize that if putting this on a cloud based infrastructure has cost any more than another type - you have wasted money. You will gain nothing with this configuration.
    It's by no means merely an academic exercise. We're talking hosting in the budget range of 100-170E per month.

    A list of active plugins can be found her:
    Plugins -- Wordpress - Webhostingtalk

    Media configuration:
    Average page contains 200-800 words and 3 images. 50% af images are hosted on a CDN (CloudFront). The rest will be migrated also, so, as I see it, what I'm after are the optimalt settings for generating the pages (php + mysql).

    The sites can be reviewed her:

    Bergholts opskrifter
    kasperbergholt.org

    Traffic distribution
    99% of all users visit to read/browse. Average visit depth is 3 pages. Rarely does a visitor place a comment.

    Traffic is evenly distributed between 9 am and 22 pm.

    Technical setup
    SAN-based diskless nodes. SAN is baed on Hitachi UPS-V with HDS AMS & IBM DS. IBM Tivoli storage backup.

    2 vCPU equivalent of an Amazon ECU each (i.e. 400 passmark). RAM is latest genration of DDR3.



    <<< Signatures need to be set up in your profile. >>>
    Last edited by SoftWareRevue; 04-18-2011 at 10:53 AM.

  10. #10
    Join Date
    Nov 2009
    Posts
    544
    The price of your hosting is relative, the choice to do this one way based on price and not another way that you admit would be better makes this just academic.
    If price was no concern, yes I'd split up the project to run on separate servers. But economy and price is an issue.
    The list of plug-ins is certainly larger than the 7-10 figure mentioned earlier. Each one of the plug-ins will have recommended figures for at least PHP / WP settings and many will mention the database calls required.

    Going through the large list of plug-ins provided is far beyond what could be done from the forum. I can only imagine that most of these plug-ins are unnecessary and a few will probably conflict with each other. Off the top I would recommend looking at "All In One SEO Pack", "AutoBlogged" and "DB Cache Reloaded" to consider if they are needed and if so, at least understand fully what they are doing and the impact of individual settings. Then go through all plug-ins.

    Though you are hosting images on a CDN many plug-ins will call for locally stored images for thumb-nailing and such.

    If visitors are simply readers the load on the standard WordPress installation would be fairly light. Since you have seen the need to invest in higher level hosting, the CPU, Memory and Database requirements are coming mostly from the plug-ins.

    There is also an issue in code generation on the sites you presented for review. Several CSS issues, Security Warnings, JS issues, etc... I presume that these issues are from inefficient plug-ins or mistakes in customization somewhere but they will be performance hits.

  11. #11
    Join Date
    Nov 2009
    Posts
    544
    PS: I noticed that you have used loadimpact.com. What were your results there?

    You may want to look at Applications such as Apache Benchmark, jmeter and grinder

  12. #12
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by srfreeman View Post
    PS: I noticed that you have used loadimpact.com. What were your results there?

    You may want to look at Applications such as Apache Benchmark, jmeter and grinder
    I ran a Loadimpact test yesterday on kasperbergholt.org, and concurrency was fine.

    I've just migated bergholt.net to the new cloud setup today, and have run out of free tests, but will post tomorrow.

    Apache Benchmark:


    Concurrency Level: 10
    Time taken for tests: 19.576685 seconds
    Complete requests: 50000
    Failed requests: 0
    Write errors: 0
    Non-2xx responses: 50006
    Keep-Alive requests: 49024
    Total transferred: 33410047 bytes
    HTML transferred: 15601872 bytes
    Requests per second: 2554.06 [#/sec] (mean)
    Time per request: 3.915 [ms] (mean)
    Time per request: 0.392 [ms] (mean, across all concurrent requests)
    Transfer rate: 1666.57 [Kbytes/sec] received

    Connection Times (ms)
    min mean[+/-sd] median max
    Connect: 0 0 0.2 0 5
    Processing: 0 3 3.9 3 236
    Waiting: 0 2 4.0 3 236
    Total: 0 3 4.0 3 236

    Percentage of the requests served within a certain time (ms)
    50% 3
    66% 4
    75% 5
    80% 5
    90% 6
    95% 6
    98% 8
    99% 9
    100% 236 (longest request)

    Httpd settings:

    <IfModule prefork.c>
    StartServers 4
    MinSpareServers 3
    MaxSpareServers 8
    ServerLimit 160
    MaxClients 160
    MaxRequestsPerChild 2000
    </IfModule>

    ---

  13. #13
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by srfreeman View Post
    PS: I noticed that you have used loadimpact.com. What were your results there?

    You may want to look at Applications such as Apache Benchmark, jmeter and grinder
    LoadImpact stats here:
    http://loadimpact.com/result/berghol...45f63dcb77e9fc

    Looks ok to me?

    The server peaked at load level at 4.0 at concurrency level 50.

    IO wait was the reason.

  14. #14

    Try Xeround Cloud Database to get better performance and scalability

    you can try it for free now, it has auto scaling works on multiple machines with high availability.

  15. #15
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by akapuya View Post
    you can try it for free now, it has auto scaling works on multiple machines with high availability.
    'cuse me, try what?

  16. #16
    Join Date
    Aug 2000
    Location
    Sheffield, South Yorks
    Posts
    3,480
    Quote Originally Posted by bergholt View Post
    [mysqld]
    max_user_connections=8
    You might want to delete that one in this case, if there's only two sites running, then that's presumably just 2 usernames, so only ever going to use 16 of those 500 connections you've allowed
    Karl Austin :: KDA Web Services Ltd.
    UK Business Hosting and Managed Servers - Hosting for Business Users :: 0800 5429 764
    Call us today and ask about our hosting solutions.

  17. #17
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by KDAWebServices View Post
    You might want to delete that one in this case, if there's only two sites running, then that's presumably just 2 usernames, so only ever going to use 16 of those 500 connections you've allowed
    Very good point. I actually hit the limit today -- and increased to the same amount as the max-connections variable.

Similar Threads

  1. plesk 7.5 CP & mysql tuning problems?
    By carpman in forum Hosting Software and Control Panels
    Replies: 2
    Last Post: 08-24-2007, 08:30 AM
  2. Replies: 0
    Last Post: 03-25-2006, 04:56 AM
  3. Replies: 0
    Last Post: 03-08-2006, 11:16 PM
  4. Replies: 4
    Last Post: 12-29-2005, 02:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •