-
In #odoo 18, it will be possible to scale your Odoo database horizontally using readonly-replicas. github.com/odoo/odoo/pull/112000 What does it mean and when should you use it?
-
Vertical scaling = throwing more powerful hardware at the problem Horizontal scaling = sharing the workload across multiple machines
-
Both approaches have their pros and cons - vertical is usually simpler to set up but will yield increasingly smaller returns per dollar. Horizontal is more complex but usually allows to scale much, much larger with a more stable ROI per dollar invested.
-
As often with scaling, different approaches have different pros and cons. Using replicas should be seen as one of the *last step* in scaling - vertical scaling should be considered first as it is much, much simpler to manage.
-
In order of increasing complexity, I would advise deployments to scale in this manner: 1/ single machine with local postgres setup: avoids network roundtrips for db-queries (which can be very expensive w/ regards to timing!); scale by upgrading to machines with more CPUs/more RAM
-
2/ horizontal scaling with centralized db server: deploy multiple 'frontend' servers where odoo runs and that connect to a single db server; this allows scaling in a more cost-controlled way as at some point having 2 mid-tier machines is cheaper than one god-like machine
-
(this approach can scale *a lot* already as long as your db host machine has a lot of oomph - odoo.com currently runs on such a setup with 3000+ internal users and 1.5-2M website page views per day)
-
3/ as a final step, switch to multiple odoo servers that connect to multiple db server - most requests are actually readonly and can be spread out on database replicas. We believe this can scale your throughput by a factor of 10 or so; though it will make write requests slower...
-
...as database replication has to travel over the network to the replicas and since we want immediate consistency, the transaction will only return once the replication has occurred ('ultimately consistent' is not good enough for a business-centric application like odoo)
-
We plan on switching odoo.com to this setup in the coming months and iron-out any issue in this new scaling method until we make it available widely in Odoo 18. There'll be a talk about it at #OdooExperience 2024 for sure!