Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I don't know why, but the PHP-FPM script is taking a lot from the CPU.</p> </blockquote> <p>And what makes you think that's a problem? When a server isn't CPU limited the programs will run as fast as they can using as much CPU as is available to them. The only time when high CPU usage really matters is when the server can't process requests fast enough, as all the scripts are competing to use CPU resource, and blocking each other from running.</p> <p>You script is running as fast as it possibly can, (i.e. using as much CPU as it can) because you've told it to:</p> <pre><code>$download = new ResumeDownload($file, 0); //delay about in microsecs </code></pre> <p>i.e. your download script isn't ever waiting and so it's looping as fast as it can to push data into the network connection. </p> <p>Pretty obviously a server can push data into a network connection faster than it can be sent over the internet, so a lot of the time your script it just looping and waiting for the network connection to be able to send data - as evidenced by the high idle time at the top of the 'top' output.</p> <p>You could just set the delay to make the script actually sleep or you could use Nginx <a href="http://wiki.nginx.org/XSendfile" rel="nofollow noreferrer">x-accel</a> to completely remove the load from PHP. There's a config for that here: <a href="https://stackoverflow.com/questions/16189758/serve-large-file-with-php-and-nginx-x-accel-redirect/16210703#16210703">Serve large file with PHP and nginx X-Accel-Redirect</a> That would be much more efficient in situations where you are actually CPU bound.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload