我的服务器配置了32个核心处理器,但是当我只运行odoo实例时,实例只使用一个核心,剩下的所有31个核心都是理想的......因此服务器正在超载..
答案 0 :(得分:1)
首先,你需要检查为什么Odoo工作缓慢。有几个可能的原因。其中一些:
您可以在Odoo配置文件中设置此属性:
内存选项:
--osv-memory-count-limit=OSV_MEMORY_COUNT_LIMIT
Force a limit on the maximum number of records kept in
the virtual osv_memory tables. The default is False,
which means no count-based limit.
--osv-memory-age-limit=OSV_MEMORY_AGE_LIMIT
Force a limit on the maximum age of records kept in
the virtual osv_memory tables. This is a decimal value
expressed in hours, and the default is 1 hour.
--max-cron-threads=MAX_CRON_THREADS
Maximum number of threads processing concurrently cron
jobs (default 2).
多处理选项:
--workers=WORKERS Specify the number of workers, 0 disable prefork mode.
--limit-memory-soft=LIMIT_MEMORY_SOFT
Maximum allowed virtual memory per worker, when
reached the worker be reset after the current request
(default 671088640 aka 640MB).
NOTA: if this size of memory is reached, a SIGINT signal is sent to Odoo to finish the process in a correct way
--limit-memory-hard=LIMIT_MEMORY_HARD
Maximum allowed virtual memory per worker, when
reached, any memory allocation will fail (default
805306368 aka 768MB).
NOTA: if this size of memory is reached, a SIGKILL signal is sent to Odoo to finish the process in a abrupt way
--limit-request=LIMIT_REQUEST
Maximum number of request to be processed per worker
(default 8192).
<强>工即可。 --workers
的非零值激活多处理。多处理可以提高稳定性,更好地利用计算资源,可以更好地监控和限制资源。
工人计算数:
虽然我在Odoo论坛或其他地方看到了这个:
每个可用CPU使用2个工作线程+ 1个cron线程,每10个concurent用户使用1个CPU。确保调整内存限制和CPU限制。 我建议密切监视服务器资源(CPU,内存,网络等),以便进一步调整参数。
内存大小计算。
我们认为20%的请求是繁重的请求,而80%是更简单的请求 一个沉重的工作者,当所有计算字段设计得很好时,SQL请求设计得很好,...估计消耗大约1Go的RAM
在相同情况下,较轻的工作人员估计会消耗大约150MB的RAM
Needed RAM = #worker * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )
PostgreSQL内存。
将shared_buffers设置为可用内存的20%,将effective_cache_size设置为可用内存的50%。在配置文件中更改这些参数:
shared_buffers = 3072MB
effective_cache_size = 8192MB
不时向vacuum数据库推荐
如果您的VPS具有8个CPU内核和16 GB RAM,则工作者数量应为17(CPU核心* 2 + 1),总限制内存 - 软值将为640 x 17 = 10880 MB,和total limit-memory-hard 768MB x 17 = 13056 MB,因此Odoo将使用最大12.75 GB的RAM。
workers = 17
limit_memory_hard = 805306368 # total >> 13690208256
limit_memory_soft = 671088640 # total >> 11408506880
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
max_cron_threads = 2