PHP Performance (memory) related issues

Source: Internet
Author: User
PHP Performance (memory) issues
Author: zccst

Encounter such a problem

$RETARR = Array (); Order of magnitude: 10/Hundred

One of the fields is a model, an array of eligible models
$MODELARR = Array (); Order of magnitude: thousand

One of the fields is SN, the SN array of the complex condition
$SNARR = Array (); Order of magnitude: 100,000 articles


Test instructions: There is SN information in the $MODELARR, but to determine if the SN is in $snarr, if it is, the compound condition is indicated, if it does not indicate a non-conforming condition (such as not on the line).

Issue: 100,000 *1000*100 = 10 billion of data, resulting in insufficient memory.


Solution 1: Use In_array ($key, $DESTARR);

The actual run found insufficient memory.


Workaround 2: Combine SQL queries.

Possible, but it will take 1-2 minutes to run. The default timeout for front-end ExtJS is 30 seconds, so changing the default time-out to 5 minutes resolves the problem.



  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.