R8B-0 devpoll patch

Per Bergqvist per@REDACTED
Tue Feb 26 02:21:44 CET 2002


Hi,                                                                   
                                                                      
Even if you don't like to patch your Erlang releases this             
is one you really want if you run Linux (2.4.x) or Solaris 8.         
                                                                      
This patch implements support for /dev/poll in Solaris                
and /dev/epoll for Linux.                                             
                                                                      
The idea about /dev/[e]poll is to declare interest in a file          
descriptor once to the kernel rather than building large              
poll descriptors and shuffle them around.                             
/dev/epoll (eventpoll) takes it a bit further and mmaps the           
result set allocated by the driver to the process.                    
                                                                      
In tests I have run 8192 concurrent persistent TCP sessions           
pumping 1MB/s over and 10 Mb ethernet with 70% idle cpu on a          
Celeron 650MHz.                                                       
The Solaris variant is less efficient but still gives much            
better performance compare to traditional poll when you have          
many, many file descriptors in use.                                   
                                                                      
Files modified by this patch:                                         
erts/acconfig.h                                                       
erts/configure.in                                                     
erts/emulator/sys/unix/sys.c                                          
                                                                      
To apply the patch:                                                   
                                                                      
# cd $ERL_TOP                                                         
# patch -p1 < devpoll_patch                                           
# cd erts                                                             
# autoheader                                                          
# autoconf                                                            
# cd ..                                                               
# ./configure                                                         
# make                                                                
                                                                      
If you don't have autoheader and autoconf I have attached             
new versions of config.h.in and configure as well.                    
Please note that they should be copied to the erts directory and      
nowhere else.                                                         
                                                                      
A final note on Linux:                                                
To make eventpoll (/dev/epoll) useable for Erlang I modified          
the driver to be pollable itself and to use ms timeouts.              
Davide Libenzi have incorporated the fixes in release 0.28.           
Get this (or later) from                                              
http://www.xmailserver.org/linux-patches/nio-improve.html             
                                                                      
Have fun and please let me know of your experiences.                  
                                                                      
Per                                                                   
                                                                      
=========================================================             
Per Bergqvist                                                         
Synapse Systems AB                                                    
Phone: +46 709 686 685                                                
Email: per@REDACTED                                                   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: devpoll_patch
Type: application/octet-stream
Size: 12171 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20020226/ec8afbb5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.h.in
Type: application/octet-stream
Size: 8912 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20020226/ec8afbb5/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure
Type: application/octet-stream
Size: 163690 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20020226/ec8afbb5/attachment-0002.obj>


More information about the erlang-questions mailing list