what are normal ways to scale up PHP's default settings for growing traffic?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    what are normal ways to scale up PHP's default settings for growing traffic?


    PHP comes with certain defaults, set in php.ini. Among these, scripts
    time out after 60 seconds, I think. The default memory limit for a
    script is, I believe, 8 megs.

    I assume that when people do large-scale sites with PHP they scale
    these numbers up. If you have a content management system running every
    aspect of a large corporate web site, including a database back end
    that employees use for important, secret, protected information, then I
    imagine there is quite a lot of processing that might be needed for
    every request.

    A limit that I run into all the time is the memory limit. If I get a
    large amount of info back from the database, and then try to store the
    return in an array, it is easy to go over the default 8 meg limit.

    So is it normal to scale up the default numbers? If so, by how much?

  • Gordon Burditt

    #2
    Re: what are normal ways to scale up PHP's default settings for growing traffic?

    >PHP comes with certain defaults, set in php.ini. Among these, scripts[color=blue]
    >time out after 60 seconds, I think. The default memory limit for a
    >script is, I believe, 8 megs.
    >
    >I assume that when people do large-scale sites with PHP they scale
    >these numbers up. If you have a content management system running every
    >aspect of a large corporate web site, including a database back end
    >that employees use for important, secret, protected information, then I
    >imagine there is quite a lot of processing that might be needed for
    >every request.[/color]

    Just because the site is large doesn't mean more processing for
    every request. Just because the site is small with only one user
    doesn't mean it won't have huge result sets that won't fit in 8 meg
    or do a bunch of crunching that will take an hour of CPU time. And
    the CPU time limits don't apply to how much CPU time your database
    queries use in the database process.
    [color=blue]
    >A limit that I run into all the time is the memory limit. If I get a
    >large amount of info back from the database, and then try to store the
    >return in an array, it is easy to go over the default 8 meg limit.[/color]

    There's no way you can limit the result set further? (In MySQL,
    if you want to paginate the output to, say, 10 items per page, the
    LIMIT clause can be used to retrieve only those 10 items rather
    than all of them, and then you only display the appropriate 10).
    Of course, there are plenty of reasons you might need to see all
    the data anyway. If it's not practical to limit the data retrieved,
    then you need the memory, and I see nothing wrong setting the limit
    higher.

    Setting the CPU limit to very high numbers (e.g. 5 minutes and
    upwards) when this is actually needed is likely to mean unsatisfied
    users unless they are told (repeatedly) that it's normal for the
    page to take a huge amount of time to display. Give them some
    progress indication. Otherwise they keep aborting the request and
    you'll have dozens of the same request running at once.
    [color=blue]
    >So is it normal to scale up the default numbers? If so, by how much?[/color]

    Having a lot of users, a lot of requests per hour, and a lot of
    pages is not much of a reason to up these limits. Having pages
    that actually *NEED* the limits raised to function is a good reason
    to raise the limits. The limits are essentially there to protect
    against errors like infinite loops from dragging the whole site
    down with it. Seat belts save lives but not if they are adjusted
    so tight you can't breathe.

    Gordon L. Burditt

    Comment

    • Colin McKinnon

      #3
      Re: what are normal ways to scale up PHP's default settings for growing traffic?

      lkrubner@geocit ies.com wrote:
      [color=blue]
      >
      > PHP comes with certain defaults, set in php.ini. Among these, scripts
      > time out after 60 seconds, I think. The default memory limit for a
      > script is, I believe, 8 megs.
      >[/color]
      <snip>[color=blue]
      >
      > So is it normal to scale up the default numbers? If so, by how much?[/color]

      No. If you're trying to cope with more traffic, then increasing the
      resources which can be used by each process, and the length of time it can
      hold on to the processes can only *reduce* the volume of traffic it can
      cope with.

      If these limits are causing problems you need to look elsewhere for the
      answer.

      If you just want to process more traffic, then follow the standard recipes
      for tuning your webserver, and install a PHP accelerator (Zend, IonCude,
      Turck etc).

      HTH

      C.

      Comment

      Working...