Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

optimization - What to configure in Nginx and PHP7.4-fpm to handle big data to prevent blank page or blank API response?

I am developing PHP web application that requests big data from the database and response it back to the web browser and via API response.

Everything works fine! But only when the response contains to big data, I end up with blank page for HTTP GET request or blank API response for AJAX request with this message Failed to load response data. Event if I do print_r($data); die(); to just see the data and $data contains too many data I also get a blank page finally. If I loop through the response data and print only columns that contain less data, it also works fine.

foreach ($data as $model) {
    print_r($model->name); // I am using PHP framework, so the response is an array containing object models. 
    print_r($model->email);
}
die();

If I limit the response data by using limit 1 MYSQL query to get only one record or let PHP response less data $array[0] for example, it works fine as normal. If I select only columns that contain less data, it also works fine for many records that it should return. Note 1 and 0 here is just an example to refer to as less response data that shows that everything works just fine.

I have tried to change the Nginx and PHP7.4-fpm configuration such as following, but it does not help and I end up continue using the default configuration for now.

pm.max_children = 15
pm.process_idle_timeout = 10s
pm.max_requests = 1000

client_max_body_size 128M;
memory_limit = 512M
max_input_time = 60
max_execution_time = 60
post_max_size = 8M
upload_max_filesize = 2M
max_file_uploads = 20
default_socket_timeout = 60

I have tried to increase the number of things here and there and test the changes, but it did not solve the problem. I actually don't know for sure what I should look for and configure.

Note: I am working in Debian Windows Subsystem for Linux. Not sure whether it is because of that. Just want to mention it.

I don't get any error. Just when the response data (for both HTTP GET request and for AJAX request) is too big, I end up with blank page or blank API response.

What/where I should pay attention on to solve this problem?

question from:https://stackoverflow.com/questions/66062870/what-to-configure-in-nginx-and-php7-4-fpm-to-handle-big-data-to-prevent-blank-pa

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...