Re: Too very slow pages on ic 5.10.0

Andrew Baerg <[email protected]> Sun, 11 Mar 2018 21:30:48 -0600
Newsgroups gmane.comp.web.interchange.users
Message-ID <[email protected]>
On 2018-03-11 12:51 PM, Peter wrote:
> On 11/03/18 01:44, marco wrote:
>> after 3 months of installation and light use my old production catalogue
>> with:
> 
>> I notice that for the pages with heavy query became very slow and
>> sometimes bring to "Gateway Timeout"
>> "top" utility display cpu to 100% during page wait sometimes for mysql
>> and sometimes for interchange
> 
> You need to benchmark the code on the problematic pages and find out
> exactly which lines or blocks of code are causing the issue.
> 
> This is most likely going to be the result of lots of DB hits from some
> very inefficient code.  Look for calls to [data] or [field], or similar
> tags that waste db hits inside of a [loop] or similar.  Rewrite your
> code so that it does a single query to the db to get all the data you
> need instead and it will end up being way more efficient.
> 

Totally agree with this.

Also, if you are processing large queries with [query sql="..." type=list] ... [/query], consider using the hashref option [query sql="..." hashref="foo"][/query] and then processing the output in a calc block:

[calc]
  foreach $line (@{$Tmp->{foo}}) {
    ....
  }
[/calc]

I have seen page load times go from seconds to milliseconds using this strategy.

Not sure if it applies to the OP's situation, but I seem to remember having some pages that were processing large amounts of data using [query type=list] really slow down on newer Perls with UTF8 enabled in the DBD::Pg driver.

cheers,

Andrew


-- 
https://github.com/pullingshots ... https://metacpan.org/author/BAERGAJ