Performance Optimization for Large Number of Portal Users (120,000+) #170
-
We're facing performance issues in our Odoo installation, particularly with list views and user management tasks, when dealing with a large number of portal users (over 120,000 records in the res_users table).Its takes huge amount of time to load the list view more than 5 hours. Are there any other strategies or best practices we should consider for handling a large number of portal users.? note - The portal users here are not interacting with the web application directly they are created from an external API and used for recording |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
it would help if you specificify the Odoo version you are using. Also if you are able to list the installed modules that could possibly extend the portal features or contacts or objects you are showing in the portal that would help too... Cause Odoo is usually expected to deal well with large volume of records. Iideally you should start by looking what is making the CPUs busy (using top): Postgresql or python mostly. If it's mostly Postgresql, use approaches like this https://simplebackups.com/blog/postgresql-how-to-find-long-running-queries/ to hunt for slow queries and the track their origin in the Odoo code (then possibly add indexes, avoid them etc). Also hunt for repeating SQL queries and track the possible loops/"N+1 queries" issues in Odoo. These are the low hanging fruits. If it doesn't fix the issue you should then dig into the craziness of the computed fields chains. But yeah in any case optimizing 5 hours requests won't be easy. You might also consider hiring the big guys in the OCA to get it fixed. |
Beta Was this translation helpful? Give feedback.
-
The bad part about these kind of performance problems is that they are usually only discovered once they happen, and you need to use your environment, where it's happening, to diagnose and fix the issue. Each performance issue is different, but it generally narrows down to:
|
Beta Was this translation helpful? Give feedback.
-
This here also helps a lot to discover the source of bad code: |
Beta Was this translation helpful? Give feedback.
-
We are using odoo13 community edition and the issue is almost fixed temporarily. There are two issues which we were facing one is loading time of list view when we remove the internal users filter from the list view and the another one is huge time for doing create /write in the res_users table. And for the first one when we do the analysis of the query below which is running SELECT "res_users".id FROM "res_users","res_partner" as "res_users__partner_id" WHERE ("res_users"."active" = true) AND (("res_users"."share" IS NULL or "res_users"."share" = false ) OR ("res_users"."id" in (SELECT "user_id" FROM "res_company_users_rel" WHERE "cid" IN (1, 4)))) AND ("res_users"."partner_id" = "res_users__partner_id"."id") AND ((("res_users__partner_id"."partner_share" IS NULL or "res_users__partner_id"."partner_share" = false ) OR ("res_users__partner_id"."company_id" in (1,4))) OR "res_users__partner_id"."company_id" IS NULL ) ORDER BY "res_users__partner_id"."name" ,"res_users"."login" ("res_users"."share" IS NULL or "res_users"."share" = false ) This condition was taking most of the time for loading.Which is the default internal users filter. Also the reason for huge time on create/write in the records was due to the huge size of mail_message table it is fixed by deleting the records. Another issue was the creation of users with duplicate logins seems like the unique constraints on login is not working. may be related to below issues https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html |
Beta Was this translation helpful? Give feedback.
it would help if you specificify the Odoo version you are using. Also if you are able to list the installed modules that could possibly extend the portal features or contacts or objects you are showing in the portal that would help too... Cause Odoo is usually expected to deal well with large volume of records.
Iideally you should start by looking what is making the CPUs busy (using top): Postgresql or python mostly. If it's mostly Postgresql, use approaches like this https://simplebackups.com/blog/postgresql-how-to-find-long-running-queries/ to hunt for slow queries and the track their origin in the Odoo code (then possibly add indexes, avoid them etc). Also hunt for repeating SQL querie…