Help understanding this...

Discussion in 'Site & Server Administration' started by AHA7, Nov 4, 2007.

  1. #1
    Hello,

    If my website has a PHP script with size 50 KB, and the maximum number of visitors that will be viewing my site simultaneously at any given time is 1000 visitors. Which of the following statements is true:

    A- My server must have an available memory of at least 50 KB to load my site's script and all visitors viewing my site at the same time will be using the same copy of the script loaded into the memory.

    B- My server must have an available memory of at least 50,000 KB because each visitor to my site will have his/her own copy of the script loaded into the memory.
     
    AHA7, Nov 4, 2007 IP
  2. Sebastian Rametta

    Sebastian Rametta Peon

    Messages:
    13
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't think that is a valid question. More details need to be known.

    What is the php script doing? are you doing database calls? are you including other files for footer/headers? Are there any functions in the script that are requesting server resources? Is it just a php script that outputs html?

    Are you assuming that 1000 users will visit your site at the same MILISECOND?
    or would the 1000 users be spread over say 1 minute?

    - Sebastian Rametta
     
    Sebastian Rametta, Nov 4, 2007 IP
  3. AHA7

    AHA7 Peon

    Messages:
    445
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here's an example script assuming the visitors are viewing it at the same milisecond:

    <?php
    
    include 'header.php'; // contains only HTML (5 KB)
    
    ...
    ... //connect to a database to get 10 KB of plain text and output it
    ...
    
    for($i=0; $i<500; $i++)
    {
       echo "<p>This is just an example.</p>\n";
    }
    
    include 'footer.php'; // contains only HTML (5 KB)
    
    ?>
    PHP:
     
    AHA7, Nov 4, 2007 IP
  4. gunzour

    gunzour Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Strictly speaking, neither of your statements are correct, because the memory you need is dependent on a lot of other factors. As an example, my website can handle 100 users logged in at the same time with only 20 apache processes. This is because, as others have suggested above, not every user is connecting at the exact same moment. However, each Apache process takes about 8MB of memory (including whatever php script is being executed), so I need 160MB of memory just for these 20 Apache processes (8 MB times 20 processes). So if you are trying to determine your memory requirements, you need to find out how much memory each Apache process uses, and what is the max number of processes you might have running at once.
     
    gunzour, Nov 4, 2007 IP
  5. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The complete script isn't loaded. Only a page is loaded, so I'm sure that size of few files won't be more than 2 MB(the default max. file size ion PHP)

    If you need higher, this can be done by editing the file php.ini
     
    inworx, Nov 6, 2007 IP