Acceptable Memory Limit

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
createanet
Posts: 72
Joined: 22 Mar 2021, 16:56

Acceptable Memory Limit

Post by createanet » 22 Nov 2021, 10:35

Morning,

We've started noticing memory being exhausted in the stores.

An example of one is below:

Code: Select all

[2021-11-22 07:19:55] local.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) at /home/xxxxxx/vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/ListRef/Traits.php:229)
[stacktrace]
Generally speaking most sites are OK on the default 128M configured, last week I did have to bump this up for an account running aimeos to 256M, this week we now have more issues relating to memory. This error occurs when loading the catalog list on the frontend.

From what I can determine the catalog has a small list of items, around 50. However, these items to appear to be bundles. The items are loading attributes, some have a count of 1000+. The catalogs do have the ability to order from the list which I assume is why we are loading all the attributes? Or, could also be related to products now having upto 30/40 prices attached due to customer/groups - which seems off, as I would assume it would be using the default price assigned on the product for display, and not a minimum price calculation from a collection of all variants/products and their respective prices.

I don't know if it's worth noting, but locally I don't have memory issues with a configured 128M allocation. The error appears only online on a server that has shared resources. ie. there are other sites running under the same web server.

Thanks

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Acceptable Memory Limit

Post by aimeos » 23 Nov 2021, 11:40

The memory problem arises due to the amount of data and you should optimize the configuration a bit to load only those data which is really required in the catalog list view. The configuration setting for this is:
https://aimeos.org/docs/2021.x/config/c ... s/#domains

A good choice for your setup would be:

Code: Select all

['attribute' => ['variant'], 'media', 'media/property', 'price', 'product' => ['default'], 'text']
The values for "attribute" and "product" are the list types of the items which will be fetched instead of all. Thus, only variant attributes and products added as variant articles or bundle items will be fetched from the DB. In case of the prices with customer groups you have to consult the Aimeos company where you've bought the extension.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

nos3
Posts: 89
Joined: 01 Sep 2015, 13:26

Re: Acceptable Memory Limit

Post by nos3 » 24 Nov 2021, 12:35

We did some optimizations in our customergroups extension to retrieve only prices with none or current customer or customer group assigned to avoid memory consumption. You can try the new code using:

Code: Select all

composer req aimeoscom/ai-customergroups:2021.10.x-dev

createanet
Posts: 72
Joined: 22 Mar 2021, 16:56

Re: Acceptable Memory Limit

Post by createanet » 24 Nov 2021, 13:48

Oh hey @nos3, I was just responding to this thread after I made the suggested update.

Unfortunately the suggestion from @aimeos made no difference, im now also noticing that the index jobs are now longer able to complete due to the same reasons.

We are stuck on 2020.10.*, is there any chance these optimisations could be applied to that branch please?

Thanks very much

Post Reply