{"id":8550,"date":"2024-06-13T11:45:31","date_gmt":"2024-06-13T11:45:31","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8550"},"modified":"2024-08-05T06:43:53","modified_gmt":"2024-08-05T06:43:53","slug":"odoo-10-ce-performance-tuning-enable-workers-for-speed","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/odoo-10-ce-performance-tuning-enable-workers-for-speed\/","title":{"rendered":"Odoo 10 CE Performance Tuning: Enable Workers for Speed"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 4,590<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>Enabling workers in Odoo 10 Community Edition (CE) can significantly improve the performance of your Odoo instance, especially under high user loads. This is because Odoo&#8217;s default setup runs in a single-threaded mode which can become a bottleneck when serving multiple requests concurrently. By enabling and configuring workers, you can take advantage of multi-core CPUs and handle more simultaneous requests.<\/p>\n\n\n\n<p>Here\u2019s a detailed guide on how to enable and configure workers in Odoo 10 CE for better performance:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps to Enable and Configure Workers in Odoo 10 CE<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Understand Worker Mode:<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Worker Processes:<\/strong> These are separate processes that handle user requests. Each worker can handle multiple requests concurrently, allowing Odoo to utilize multiple CPU cores.<\/li>\n\n\n\n<li><strong>Longpolling:<\/strong> This is used for real-time operations (e.g., live chat, notifications). A separate worker is recommended for handling longpolling to prevent it from interfering with regular requests.<\/li>\n<\/ul>\n\n\n\n<p>     2. <strong>Estimate the Number of Workers:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The optimal number of workers depends on your server&#8217;s resources and the expected load. A common formula is: <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Number of Workers = (CPU Cores * 2) + 1<\/mark><\/code>\n<ul class=\"wp-block-list\">\n<li>This formula helps in utilizing all available CPU cores efficiently while maintaining responsiveness.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Memory Considerations:<\/strong> Ensure that you have enough RAM. Each worker typically requires 512 MB to 1 GB of RAM. You can use the following rough guideline:<br><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Total RAM Requirement = Number of Workers * Average Memory per Worker<\/mark><\/code><\/li>\n<\/ul>\n\n\n\n<p>     3. <strong>Edit the Odoo Configuration File (<code>odoo.conf<\/code>):<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the Odoo configuration file, usually located at <code>\/etc\/odoo\/odoo.conf<\/code> or <code>\/etc\/odoo10.conf<\/code>.<\/li>\n\n\n\n<li>Add or update the following lines to enable workers and longpolling: <br><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">[options] <br>workers = &lt;number_of_workers&gt; max_cron_threads = 1 longpolling_port = 8072<\/mark><\/code>\n<ul class=\"wp-block-list\">\n<li>Replace <code>&lt;number_of_workers&gt;<\/code> with the number you calculated earlier.<\/li>\n\n\n\n<li>Setting <code>max_cron_threads = 1<\/code> ensures that cron jobs are handled by a dedicated thread.<\/li>\n\n\n\n<li>The <code>longpolling_port<\/code> should be set to a free port on your server.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>     4. <strong>Adjust PostgreSQL Settings:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>With more workers, the database connection pool size should be increased. Update your PostgreSQL configuration (typically found in <code>postgresql.conf<\/code>) to handle the additional connections. Adjust the <code>max_connections<\/code> parameter to accommodate the increased number of concurrent connections.<\/li>\n\n\n\n<li>A rough estimate is:<br><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">max_connections = (number_of_workers * 2) + 100<\/mark><\/code><\/li>\n<\/ul>\n\n\n\n<p>     5. <strong>Restart Odoo and PostgreSQL:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After updating the configuration files, restart the Odoo service to apply the changes.<br><code>bash sudo systemctl restart odoo<\/code><\/li>\n\n\n\n<li>Restart the PostgreSQL service to apply the new connection settings.<br><code>bash sudo systemctl restart postgresql<\/code><\/li>\n<\/ul>\n\n\n\n<p>     6. <strong>Monitor and Adjust:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use monitoring tools like <code>htop<\/code>, <code>top<\/code>, or Odoo&#8217;s logs to observe the performance and resource usage after enabling workers.<\/li>\n\n\n\n<li>Adjust the number of workers if you notice excessive CPU usage, memory consumption, or if the server is still not handling the load efficiently.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Detailed Example Configuration:<\/h3>\n\n\n\n<p>Suppose you have a server with 4 CPU cores and 8 GB of RAM. Using the formula:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Number of Workers = (4 cores * 2) + 1 = 9<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>However, considering RAM constraints (assuming 512 MB per worker), you might opt for fewer workers:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Number of Workers = 8 GB \/ 512 MB per worker \u2248 16 workers<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>In this case, we choose a balanced number that the server can handle comfortably, say 8 workers.<\/p>\n\n\n\n<p>Update <code>odoo.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&#91;options]\nworkers = 8\nmax_cron_threads = 1\nlongpolling_port = 8072<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>Update PostgreSQL <code>postgresql.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">max_connections = (8 workers * 2) + 100 = 116<\/mark><\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Tips for Effective Tuning:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Test Gradually:<\/strong> Start with a moderate number of workers and incrementally increase them while monitoring the server&#8217;s performance.<\/li>\n\n\n\n<li><strong>Load Balancing:<\/strong> Consider using a load balancer if you have multiple Odoo instances.<\/li>\n\n\n\n<li><strong>Caching:<\/strong> Enable and configure caching mechanisms like Redis to reduce database load.<\/li>\n\n\n\n<li><strong>Optimize Database:<\/strong> Regularly optimize your PostgreSQL database and queries to reduce the load on the database server.<\/li>\n\n\n\n<li><strong>Regular Maintenance:<\/strong> Keep your system updated and maintain regular backups and system checks.<\/li>\n<\/ul>\n\n\n\n<p>By following these steps and guidelines, you can enable workers in Odoo 10 CE to improve performance and better handle concurrent user requests.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Enabling multiple workers in Odoo 10 CE is a strategic method to boost system performance, especially in high concurrency environments, and improve the user experience. When setting up workers, it is important to consider your server&#8217;s hardware capabilities and workload requirements. By enabling and configuring workers, it ensures that your Odoo installation runs efficiently without creating bottlenecks. After following all of these steps, you can enable workers in Odoo 10 CE to improve system performance and handle concurrent user requests more effectively, which is a key benefit of best <a href=\"https:\/\/www.infinitivehost.com\/managed-odoo-server-solutions\"><strong><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\">Odoo server<\/mark><\/strong><\/a> solutions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>4,590 Views Enabling workers in Odoo 10 Community Edition (CE) can significantly improve the performance of your Odoo instance, especially under high user loads. This is because Odoo&#8217;s default setup runs in a single-threaded mode which can become a bottleneck when serving multiple requests concurrently. By enabling and configuring workers, you can take advantage of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[203],"tags":[],"class_list":["post-8550","post","type-post","status-publish","format-standard","hentry","category-odoo"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8550"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8550\/revisions"}],"predecessor-version":[{"id":8795,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8550\/revisions\/8795"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}