Project

General

Profile

Feature #19540

Review and improve the behavior of fork.py

Added by Marco Mambelli over 1 year ago. Updated 14 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
04/02/2018
Due date:
% Done:

0%

Estimated time:
Stakeholders:
Duration:

Description

In [#18748] the code was changed to use poll/epoll instead of select when possible.
There may be some performance improvements to gain changing the current code.

1. The current code seems to create a new mask for poll/epoll all the time fetch_ready_fork_result_list() is callded.
Specially epoll should work much better if a mask is kept (e.g. as module variable) and file descriptors are added/removed to it when needed. Each modification is supposedly a system call

2. Epoll may not guarantee always the best performance. poll and select work in user space so should cause less context switches than epoll. Select (in C) should work also for >1024 file descriptors if the correct array is passed in (default is 1024 long and would break). Python select.select() seems not to allow an input array. It remains to be verified if there is a way around it. # TODO: this may be revised to use select that seems more performant and able to support >1024: https://aivarsk.github.io/2017/04/06/select/

When working on this keep in mind that most python code examples for select/poll/epoll seem superficial. E.g. there is confusion on the meaning of the select flags: read as POLLIN | POLLPRI, no mention of the POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR).

Consider also [#18855], the ticket about creating a unit test. The test may also compare performance.

History

#1 Updated by Marco Mambelli over 1 year ago

  • Target version changed from v3_2_x to v3_4_x

#2 Updated by Marco Mambelli about 1 year ago

  • Target version changed from v3_4_x to v3_5_x

#3 Updated by Marco Mambelli 14 days ago

  • Target version changed from v3_5_x to v3_6_x


Also available in: Atom PDF