Answer the question
In order to leave comments, you need to log in
How to reduce the number of requests per page?
I display products on the site page, for each product a picture is displayed. Work with images goes through the popular CostaRico plugin. In view, as usual, I pass the received data on the product through compact and display it in foreach. But at each iteration, you have to access the database for searching using the getImage () method.
Thus, in addition to the request for 16 products, 16 more are made to receive a picture for each product.
Can anyone work with this plugin and can tell you how to do it right? Or is 20 requests per page the norm?
Answer the question
In order to leave comments, you need to log in
via the popular CostaRico plugin
Is the picture stored separately from the product?
Get all the necessary pictures with one request, what's the problem?
I do not work with Yii, but the image storage scheme is the same.
If a cache is used, then such a scheme perfectly keeps 4000 users a day and does not even think about stumbling.
Without a cache, of course, it's a little worse, but still, selecting images by index is a fairly simple matter.
If you are very worried, then you can select pictures in advance with one request, as suggested above. But in practice, this will justify itself either if you have a very weak server, or if there are a lot of users.
Collect id-shniki and pull out all the images with one request
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question