Graphqlbundle: Performance issue when executing GraphQL query in Executor

Created on 30 Apr 2018  路  6Comments  路  Source: overblog/GraphQLBundle

| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Version/Branch | 0.9.3

Hello!

I've noticed when I use the execute method from the Executor in a loop, every x iterations, my PHP memory usage keeps increasing. First I thought it was from my application, then I isolated the query, ran it in a loop, and saw that in this case too my memory usage would increment slowly (depending on the complexity of the query, it increases by about 20 to 100 MB every 4-5 iterations). I really don't know where it come from, I've tried unsetting the variable where I stored the result of the query, tried gc_enable(), gc_collect_cycle() and also disabled debug info for the Executor, but it does nothing, so maybe it is a bug.

Here is an example to demonstrate what I'm currently doing :

do {
$proposalsQuery = $this->getContributionsGraphQLQueryBySelectionStep($this->currentStep);
    $proposals = $this->executor->execute([
        'query' => $proposalsQuery,
        'variables' => [],
    ]);
    $this->printMemoryUsage($output);
} while (true); // the infinite loop is here as an example, I don't do this in my code, the condition is a little more complex

where printMemoryUsage is a simple method used to print my average memory usage and the peek, and getContributionsGraphQLQueryBySelectionStep is where I get my GraphQL request. And just by doing this, my memory usage keeps incrementing by itself.

memory size increasing

It is really weird that the memory usage seems to increase every 5-6 iterations 馃

(version used of GraphQLBundle : v0.9.3)

I hope I made it clear! :)

bug performance

Most helpful comment

That's true! I'll apply the patch as fast as possible.

All 6 comments

Hi, thanks for reporting, can you provide the version you are using please?

I'm using the version 0.9.3 of the bundle

This issue has been fixed in latest 0.11 version, can you upgrade to this version? I'll try to apply a patch on 0.9 and 0.10 but this could take a while.

I'll try, but it seems that those latest versions works only with symfony ^3.1, whereas I'm currently using 2.8.36.

I'll try to update to 0.11 if I can, thanks you for the reply 馃憤

That's true! I'll apply the patch as fast as possible.

For some reasons of time and of compatibility it is not possible to fix that without introducing BC. Sorry but the only solution is to upgrade to 0.11. Feel free to continue discussion if needed.

Was this page helpful?
0 / 5 - 0 ratings