markhuot / craftql

A drop-in GraphQL server for Craft CMS
Other
319 stars 53 forks source link

High memory usage (unreleasable) - Disable Cache? #328

Open yoroshikun opened 4 years ago

yoroshikun commented 4 years ago

It seems that calling multiple queries in succession (about 10-50, (Gatsby build)) craft/php begins to over use its allocated memory. I allocate craft 256M of memory (to php) as indicated in my docker file.

RUN echo "upload_max_filesize = 10M" > /usr/local/etc/php/php.ini && \
  echo "post_max_size = 10M" >> /usr/local/etc/php/php.ini && \
  echo "max_execution_time = 300" >> /usr/local/etc/php/php.ini && \
  echo "memory_limit = 256M" >> /usr/local/etc/php/php.ini

and I also have limited the docker container to 300MB of ram using docker-compose mem_limit

After starting a build (Gatsby begins to hit the endpoint with queries) the craft sever quickly hits the memory limit imposed on it by docker (ignoring the memory limit imposed by php) which results in an 500 error (Out of memory, on the server logs).

The server that I run this in production is a small 1gb ram DO droplet with two replicated environments (staging, production) hence the strict ram restrictions.

Is there any way to either disable caching or reduce its impact when running consecutive queries?

Any help will be appreciated.

Thank you in advance!