-
Notifications
You must be signed in to change notification settings - Fork 23.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] core: support more than 255 http workers #97831
Conversation
Benchmark: empty basebase, only base web and test_http, started with 16 http workers. |
6a4bbe8
to
1f7a62b
Compare
Hi @Julien00859 Thank you for the review and the improves in the changes I just ran the following command in my local environment:
And the result was:
|
Hello @moylop260, Thank you for letting me know, indeed there is an issue. I thought
I'll remplace |
My above statement is invalid, windows lacks |
1f7a62b
to
eaa3325
Compare
eaa3325
to
5716ea4
Compare
I just updated your code and it is not raising the error 🎉 I am not even sure why are you removing the except select.error as e:
if e.args[0] not in [errno.EINTR]: |
It is no more necessary, the actual low-level |
Hi @Julien00859 I just realized that odoo@16.0 is using
However, the issue of using many workers is still reproduced since there are lines of code using directly
It could be using different selector for bus and service |
I did review the PR that changed the bus model to use websockets and I suggested to use So you are absolutely right, there are code using selector in 16.0 :) We took the opportunity that websocket was being extensively tested to include that change. |
5716ea4
to
069ceb2
Compare
@odoo/rd-framework-py @odoo/rd-security up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to use the opportunity to freshen a few bits of code:
- use super instead of
Worker.start(self)
- type
multi: PreforkServer
inWorker.__init__
as currently it's really obscure when reading the code (renamingmulti
would be a large change so probably a bad idea) - create the attributes of
Worker
subclasses in their__init__
to avoid warnings, maybe use__slots__
for clarity self.eintr_pipe
can be removed, it's only used foros.close
, which can be called directly onwakeup_fd_r
andwakeup_fd_w
069ceb2
to
f23ea40
Compare
done, also changed py2 super to py3
I didn't understand, can you clarify? |
f23ea40
to
c3270c8
Compare
Currently the |
c3270c8
to
c584492
Compare
c584492
to
710124a
Compare
Use the most efficient Selector implementation available on the current platform Odoo supports only SelectSelector but it is a little obsolete python >= 3.4 supports a new high-level library Selectors: - https://docs.python.org/es/3/library/selectors.html It could to auto-choose the following ones: - SelectSelector - PollSelector - EpollSelector - DevpollSelector - KqueueSelector Using the DefaultSelector class the most efficient implementation available on the current platform will be use: - https://docs.python.org/3/library/selectors.html#selectors.DefaultSelector It helps to support better the resources of the system Using SelectSelector you are not able to run workers >=255 If you set `ulimit -n 10240` and run `odoo-bin --workers=255` the following error is raised: Traceback (most recent call last): File "odoo/service/server.py", line 926, in run self.sleep() File "odoo/service/server.py", line 852, in sleep sel.select(self.beat) File "python3.8/lib/python3.8/selectors.py", line 323, in select r, w, _ = self._select(self._readers, self._writers, [], timeout) ValueError: filedescriptor out of range in select() But using PollSelector it is not reproduced even using more workers Most of platform supports PollSelector but using DefaultSelector we can be sure that even too old system are supported too And using this High-level library will allow to use the future new improvements e.g. Epoll has better performance improvements More info about: - https://devarea.com/linux-io-multiplexing-select-vs-poll-vs-epoll - redis/redis-py#486 Co-Authored-By: Julien Castiaux <juc@odoo.com>
710124a
to
ae19259
Compare
Use the most efficient Selector implementation available on the current platform
Odoo supports only SelectSelector but it is a little obsolete
python >= 3.4 supports a new high-level library Selectors:
It could to auto-choose the following ones:
Using the DefaultSelector class the most efficient implementation available on the current platform will be use:
It helps to support better the resources of the system
Using SelectSelector you are not able to run workers >=255
If you set
ulimit -n 10240
and runodoo-bin --workers=255
the following error is raised:
But using PollSelector it is not reproduced even using more workers
Most of platform supports PollSelector but using DefaultSelector we can be sure
that even too old system are supported too
And using this High-level library will allow to use the future new improvements
e.g. Epoll has better performance improvements
More info about:
Co-Authored-By: Julien Castiaux juc@odoo.com