Php performance (memory) problem author: zccst encountered such a problem $ retArr = array (); // order of magnitude: 10/one of the fields is the model, model array that meets the condition $ modelArr = array (); // order of magnitude: one of thousands of fields is sn, and the sn array of the complex condition $ snAr php performance (memory) problem
Author: zccst
This problem occurs.
$ RetArr = array (); // magnitude: 10/Hundred
One of the fields is the model and an array of qualified models.
$ ModelArr = array (); // magnitude: Thousands
One of the fields is sn, and the sn array of the complex condition
$ SnArr = array (); // order of magnitude: 0.1 million
$ ModelArr contains sn information, but you need to determine whether the sn is in $ snArr. if it is in, it indicates a compound condition. if it is not in, it indicates that the condition is not met (for example, it is not online ).
Problem: 0.1 million * 1000*100 = 10 billion of data, resulting in insufficient memory.
Solution 1: Use in_array ($ key, $ destArr );
The actual operation found that the memory is insufficient.
Solution 2: use SQL queries.
Feasible, but it takes 1-2 minutes to run. The default timeout value of front-end ExtJs is 30 seconds, so the default timeout value is 5 minutes. The problem is solved.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.