Attributes in Oscar - EAV based and performance

86 views
Skip to first unread message

Web Architect

unread,
Apr 29, 2016, 1:44:30 AM4/29/16
to django-oscar
Hi,

We are running an Online Fashion store based on Oscar since last couple of months. Right now we are working on optimising the performance of the application and as all know, the major bottleneck is always Datasbase access. The performance is inversely proportional to the number of DB access (roughly) besides other things. 

Our products/product types are heavily attribute dependant - which we show on the product details page. Also, our products (like shoes, clothes) have multiple variants based on size and colors and a buyer can choose a specific variant based on these attributes. All these information are rendered on the product details page. Now, a major drawback of EAV model (though it makes the creation of attributes dynamic) is that it is results in huge number of queries to DB for the product details page (almost hitting 100+ queries) - hence, resulting in poor performance of the app server for the page. 
I reduced the queries to almost 40 by using prefetch_related but still I think it's quite a lot. Hence, I have added the attributes directly to the Product model (probably not the best approach) considering that right now almost all our products have similar attributes. I compromised on the flexibility of attributes creation and also loosing the attributes being attached to the Product types. But this significantly improved the performance (which is obvious) by reducing the number of queries. 

Well, someone could suggest template caching from DTL would be good but still for a page being rendered the first time or after cache expiry- the page loading is hit. 

Would really appreciate if anyone could suggest the best approach for the above issue without compromising on the flexibility of attributes.

Thanks.


Eugene Kirillov

unread,
Jun 15, 2016, 12:30:22 PM6/15/16
to django-oscar
Hi, have you tried to shard database ? You can really benefit from sharding/clustering of database and there is some tools to do it https://github.com/JBKahn/django-sharding
I think you can optimise database performance by sharding + caching of database. also there is an option to move some intensive insert operations tables to mongodb(which will be nice option only for high insert operation but not the best option for complex retrieval of data).
What database engine you are using now ? 
Reply all
Reply to author
Forward
0 new messages