Results 1 to 7 of 7

Thread: Need to prepare for user overload!!!!

  1. #1
    Join Date
    Mar 2008

    Need to prepare for user overload!!!!

    Howdy, I have a question regards my website. Next week 30 000 users are going to hit my website at once and it will timeout. I want to put a message asking users to come back later and explain the problem (too many users at once). My site is a PHP/mySQL site on Linuz/Apache. I have a .htaccess file that usually deals with errors and I wass wondering if adding to this would cover me for 5++ errors (like 503, 509).

    For example:

    ErrorDocument 400 https://www.mysite.co.uk/page-not-found.php
    ErrorDocument 403 https://www.mysite.co.uk/page-not-found.php
    ErrorDocument 404 https://www.mysite.co.uk/page-not-found.php
    ErrorDocument 500 https://www.mysite.co.uk/server_down.html
    ErrorDocument 501 https://www.mysite.co.uk/server_down.html
    ErrorDocument 503 https://www.mysite.co.uk/server_down.html
    ErrorDocument 509 https://www.mysite.co.uk/server_down.html

    I'm confused that if mysite is downdue to demand can I redirect the user to a page that (although light in size) is actually on that domain (i.e. www.mysite.co.uk)

    Is this the right thing to do or do I need a subdomain?


  2. #2
    Join Date
    Nov 2008
    If your site receives too much traffic chances are apache is going to start trying to spawn new child processes on disk (as opposed to in memory) and that will likely be the cause of any slow down - either that or if it is configured to only spawn a maximum number of processes then requests will be queued (I think the default is 150). In these cases then Apache is going to be just as slow serving up your error pages as anything else.

    What sort of time frame are you expecting these 30000 users to access your site over? Minutes? Hours? Days? A site I manage routinely handles a few hundred requests every second without Apache breaking a sweat, 30000 users is not necessarily an issue unless they all come at once (like in the same few minutes) - unless you are on a restrictive shared host of course, but then I wouldn't recommend hosting a site with that sort of volume of traffic on a shared box!
    The first rule of Tautology Club is the first rule of Tautology Club.

  3. #3
    Join Date
    Mar 2008
    Hi there, thanks for that. I'll be getting the hits over a series of minutes as the site will be selling tickets for a very popular event. Last year the site did go down and I know that in the server control panel (I'm on a share at the moment) there is a Maximum simultaneous processes setting. I know I'll have to move to a dedicated server as soon as but it's too late for this year. What should I do and how can I put the holding/splash screen up once I've hit this maximum?

  4. #4
    Join Date
    Mar 2008
    Just one thing I am on a share but it's an expensive share! Business Managed Server I from 1and1

  5. #5
    Join Date
    Mar 2008
    Actually - I have a server, not a share.

  6. #6
    Join Date
    Mar 2010
    If you're going to be receiving that much traffic over that short of a period i'd recommend having your hosting setup a load balancer between your current server another dedicated server. You can then load balance using the least connections method. This will also offer you failover if one of the servers die during this period.
    You'll have to check with your host to see what the price is and judge it it will be cost effective.

  7. #7
    Join Date
    Nov 2008
    If you are indeed on a dedicated box with reasonable hardware then I would imagine that 30k users over some minutes is perfectly ok with a properly configured server - obviously this is a very general statement, a lot depends on the specifics of you site obviously, and your users will, I'm sure, notice some slow down but I wouldn't have thought the server will give up the ghost all together. They key is in configuring it properly. Here is a snippet from my server's httpd.conf:

    StartServers 32
    MinSpareServers 10
    MaxSpareServers 30
    ServerLimit 1024
    MaxClients 1024
    Now, this is a very powerful machine, but it will easily handle hundreds of requests per second. The key is the MaxClients (and ServerLimit since MaxClients cannot be > ServerLimit), however you can't just go raising this arbitrarily since if you use up all of the server's RAM Apache will start using the hard disk as mentioned above and that == sloooooow. You need to figure out how much RAM an apache process is using and make sure you have enough RAM to cover the MaxClients setting. You can do this via a shell with the following command (obviously change the httpd in the first grep if your server process is named differently):

    ps -ef |  grep httpd | grep -v ^root | awk '{ print $2 '} | xargs pmap -d | grep ^mapped: | awk '{ print $4 }' | cut  -dK -f1 | awk '{ SUM += $1} END { print SUM/NR"KB" }'
    You can then divide your available RAM by this figure for a rough guide. Bear in mind though this is *available* RAM, ie after accounting for the other running processes, notably MySQL which is the biggest RAM hog on my server (so it may be worth making sure all your tables are nicely indexed too to save on resources consumed there).

    If you Google for "apache performance tuning" and similar I'm sure you will find lots of other resources too.

    IMO it will be far preferable if you can keep your server up. If it is overloaded, people are not going to get anything except error messages from their browser.

    BTW in case you are not aware of it, ApacheBench is a very useful tool for testing your configuration. You might also want to whip up a PHP script to hammer your server with HTTP requests and see how it copes with the load (just discard the response data).

    If tuning doesnt look like it will get you what you need, then I'd agree with the above and look into load balancing, but that is not without its own issues. Generally though you can get a lot from the LAMP stack by configuring it properly and not sticking with the default settings.
    Last edited by Mindzai; 03-26-2010 at 12:21 PM.
    The first rule of Tautology Club is the first rule of Tautology Club.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11907 seconds
  • Memory Usage 2,912KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (7)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates