Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:48:05+00:00 2026-06-17T15:48:05+00:00

I have a strange problem I cannot handle. I don’t know what to do,

  • 0

I have a strange problem I cannot handle. I don’t know what to do, I already set the php.ini to the following:

max_execution_time = 120
memory_limit = 1024M
output_buffering = on
compression is turned off

The webserver is idling at about 95% and has free memory of 6GB.

I also tuned apache MPM:

mpm_prefork_module:
StartServers          500
MinSpareServers       500
MaxSpareServers      1000
MaxClients          5500
MaxRequestsPerChild   0

But this all does not help at all (I also tried different values).

I need to handle about 3000 incoming API requests per minute. I need to return about 50KB for each.

The server can handle that amount of incoming requests. I tested it. It just can’t throw all the data out. There is a kind of throttling. But when testing the bandwith, I get the full 100MBit.

Here is my problem:

When I download a static binary file via apache2, I have a speed of 12000 KiloByte/sec, so that’s nearly the whole 100MBit connection.

I created a php file that does all the API stuff, but not returning the result. It just returns some random data of a specific size. Now I am loading this file/data with many threads (1000 at the time) from a different server.

Now I checked how many requests the server handles per minute. I calculated the transfer rate per seconds.

      0 byte = about 5000
   1000 byte = about 3000 =  50 Kilobyte/sec
  10000 byte = about 1600 = 266 Kilobyte/sec
  50000 byte = about  430 = 358 Kilobyte/sec
 100000 byte = about  337 = 561 Kilobyte/sec
 500000 byte = about   69 = 567 Kilobyte/sec

This shows that the server can handle the demanded amount of requests (it could handle 5000 per minute instead of the 3000 I need), when not returning the data. When I return the 50KB I need, then I only get 430 requests per minute. It doesn’t matter if I return the random or the real data, using the real PHP file ore just a dummy returning some random 50KB data. This does not make any difference.

What can I do to solve the php throttling issue?

Here is some sourcecode that will lead to the same throttling issue:

<?
$chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

for ($i = 0; $i < 50000; $i++) 
{
  echo $chars[rand(0, strlen($chars))];
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:48:06+00:00Added an answer on June 17, 2026 at 3:48 pm

    There could be several factors at play here:

    PHP’s Overhead

    Even for a basic script that just splats out a file, PHP has to initialize its self. There’s a cost to that.

    Memory Overhead

    Chances are, your PHP script is causing the entire 50KB of data to be copied into memory (cost to that too). Unless you’re jumping through hoops to stream the result, this is most likely happening.

    Buffering

    Similar to above, if you are not streaming/chunking the result – PHP has to load the entire chunk of data into memory before emitting it to the requester.

    Unknowns

    There’s a lot of moving parts in PHP’s guts, and it’s probably not safe to make many assumptions about where the slowdown really is without dissecting and profiling your specific script.

    Solving it

    Web servers like apache and nginx are well optimized for serving static files. Let them do that; they will always be faster than introducing a layer of indirection between them.

    I don’t know enough about your specific problem, but general guidelines:

    • Have the PHP script do basic processing, and then redirect to a URL that is served directly by your web server.
    • If you need a security layer; consider setting up throwaway URLs or a server module that can quickly check whether the requester has access (but doesn’t have to manage w/ streaming file contents)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a strange problem about in_array recently which I cannot understand. e.g.
Friends, I have a strange need and cannot think my way through the problem.
I have a strange problem with Eclipse Galileo. I set Java 1.6 as my
I have a very strange problem, which took already several hours of my attention:
I have this strange problem parsing XML document in PHP loaded via cURL. I
I have a strange problem with inheritance and I don't understand why it should
I have a very strange problem. The following code gives different results when compiled
i have a very strange problem which i cannot solve at the moment. i
I have a very strange problem that I cannot solve. There is something preventing
I have a bit of a strange problem, please examine the following SQL CREATE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.