[issue31610] Use select.poll instead of select.select in SocketServer.BaseServer.serve_forever

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:

> I recommend to use selectors.PollSelector and fallback on 
> selectors.SelectSelector where not available (Windows) in order to use 1 
> syscall only. That's what we did already in socket.py, subprocess.py and 
> others.

It would be nice to have an API in selectors to get a "lightweight" selector, 
for selector and poll.

This API would be appropriate to check on macOS if poll() works or not: 
bpo-28087.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31610] Use select.poll instead of select.select in SocketServer.BaseServer.serve_forever

2017-09-28 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I recommend to use selectors.PollSelector and fallback on 
selectors.SelectSelector where not available (Windows) in order to use 1 
syscall only. That's what we did already in socket.py, subprocess.py and others.

--
nosy: +giampaolo.rodola

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31610] Use select.poll instead of select.select in SocketServer.BaseServer.serve_forever

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:

> Better alternative will be to use poll or epoll even.

epoll requires mulitple system calls, whereas the selector seems to only be 
used only once in most cases, no?

Anyway, maybe selectors.DefaultSelector can be used here?

About poll(): be aware of macOS issues with poll() :-/

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31610] Use select.poll instead of select.select in SocketServer.BaseServer.serve_forever

2017-09-27 Thread Беатрис Бонева

New submission from Беатрис Бонева :

The select function does not work for file descriptors with number >= 1024. It 
has FD_SETSIZE limit (see 
https://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select#7977082).
So, serve_forever won't work if more than 1024 file descriptors are opened in 
the process (ValueError: filedescriptor out of range in select() is raised).
Moreover, the select function is considered inefficient, hard to scale and 
old-fashioned nowadays. Refer to 
https://stackoverflow.com/questions/970979/what-are-the-differences-between-poll-and-select#3951845.
Better alternative will be to use poll or epoll even.

--
components: Library (Lib)
messages: 303127
nosy: Беатрис Бонева
priority: normal
severity: normal
status: open
title: Use select.poll instead of select.select in 
SocketServer.BaseServer.serve_forever
type: performance

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com