Commit Graph

404 Commits

Author SHA1 Message Date
Willy Tarreau
de99e99ecf [MAJOR] introduced speculative I/O with epoll()
The principle behind speculative I/O is to speculatively try to
perform I/O before registering the events in the system. This
considerably reduces the number of calls to epoll_ctl() and
sometimes even epoll_wait(), and manages to increase overall
performance by about 10%.

The new poller has been called "sepoll". It is used by default
on Linux when it works. A corresponding option "nosepoll" and
the command line argument "-ds" allow to disable it.
2007-04-16 00:53:59 +02:00
Willy Tarreau
ef1d1f859b [MAJOR] auto-registering of pollers at load time
Gcc provides __attribute__((constructor)) which is very convenient
to execute functions at startup right before main(). All the pollers
have been converted to have their register() function declared like
this, so that it is not necessary anymore to call them from a centralized
file.
2007-04-16 00:25:25 +02:00
Willy Tarreau
b40d42006c [BUILD] declare epoll_* as static when using our own functions
We will have to share this code among several implementations.
2007-04-15 23:57:41 +02:00
Willy Tarreau
9f195293de [MAJOR] remove useless calls to shutdown(SHUT_RD)
shutdown(SHUT_RD) is useless on data TCP sockets. It does nothing
and consumes one syscall. Remove it.
2007-04-15 21:26:58 +02:00
Willy Tarreau
8374918cce [MAJOR] implemented support for speculative I/O processing
The pollers will now be able to speculatively call the I/O
processing functions and decide whether or not they want to
poll on those FDs. The changes primarily consist in teaching
those functions how to pass the info they got an EAGAIN.
2007-04-15 20:56:27 +02:00
Willy Tarreau
3d32d3a849 [MINOR] add support for the polling results in fdtab
Now fdtab can contain the FD_POLL_* events so that the pollers
which can fill them can give userful information to readers and
writers about the precise condition of wakeup.
2007-04-15 11:31:05 +02:00
Willy Tarreau
7a9664872e [MINOR] recompute maxfd before touching fdtab
It may be dangerous to play with fdtab before doing fd_insert()
because this last one is responsible for growing maxfd as needed.
Call fd_insert() before instead.
2007-04-15 10:58:02 +02:00
Willy Tarreau
69cad1a338 [MINOR] copy-paste typo when checking for -dk to disable kqueue. 2007-04-10 22:45:11 +02:00
Willy Tarreau
258696f5d8 [MAJOR] missing tv_now in kqueue_poll() blocking timeouts
a missing call to tv_now(&now) just after kevent() prevented
the timeouts from expiring.
2007-04-10 02:31:54 +02:00
Willy Tarreau
58094f2fd9 [MAJOR] ev_epoll: do not rely on fd_sets anymore
The new epoll-based poller uses a list of changes in order to
process only the fds which have changed.
2007-04-10 01:43:43 +02:00
Willy Tarreau
167d8b5953 [BUILD] Fix limits.h once for all
Patch #cf83df3d162687d9c74783357421bd89f596eaac was stupid. Including
limits.h is portable and easier. At least it now builds on Solaris,
FreeBSD, Linux and OpenBSD.
2007-04-09 22:16:12 +02:00
Willy Tarreau
a1973c4d82 [CLEANUP] make makefile more old sh-friendly
Older SH on Solaris does not know about $(cmd) but only know `cmd`.
2007-04-09 22:07:11 +02:00
Willy Tarreau
40562cb00c [MINOR] kqueue: use fd_clo() to close the fd
fd_clo() does not call kevent() which is not needed during a close().
This one will be faster.
2007-04-09 20:38:57 +02:00
Willy Tarreau
2ff7622c0c [MAJOR] delay registering of listener sockets at startup
Some pollers such as kqueue lose their FD across fork(), meaning that
the registered file descriptors are lost too. Now when the proxies are
started by start_proxies(), the file descriptors are not registered yet,
leaving enough time for the fork() to take place and to get a new pollfd.
It will be the first call to maintain_proxies that will register them.
2007-04-09 19:29:56 +02:00
Willy Tarreau
8755285486 [MEDIUM] kqueue: do not manually remove fds
FDs attached to a kevent are automatically removed after close().
Also, do not mark the FDs as EV_CLEAR. We want to stay informed
about readiness.
2007-04-09 17:16:07 +02:00
Willy Tarreau
8ae42f42f8 [BUILD] enable kqueue on MacOS X too
MacOS X is said to have kqueue. Let's enable it too.
2007-04-09 16:30:28 +02:00
Willy Tarreau
cd5ce2a514 [MAJOR] kqueue bug in handling infinite timeouts
Calls to kevent() need to pass NULL when there is no timeout.
2007-04-09 16:25:46 +02:00
Willy Tarreau
e1a7a2f0d8 [MAJOR] kqueue was not initialized during startup 2007-04-09 16:11:49 +02:00
Willy Tarreau
a8cff1d6a7 [BUILD] fixed a warning on OpenBSD : MIN/MAX redefined 2007-04-09 16:10:57 +02:00
Willy Tarreau
cf83df3d16 [BUILD] fix build on FreeBSD for INT_MIN/INT_MAX
FreeBSD stores INT_MIN and INT_MAX in sys/limits.h only. Other systems
(Solaris) have it in sys/types.h and do not have sys/limits.h. Let's
include sys/limits.h only if INT_MAX is not defined.
2007-04-09 15:57:51 +02:00
Willy Tarreau
63455a9be5 [MINOR] use 'is_set' instead of 'isset' in struct poller
'isset' was defined as a macro in /usr/include/sys/param.h, and
it breaks build on at least OpenBSD.
2007-04-09 15:34:49 +02:00
Willy Tarreau
69801b8e77 [MINOR] removed proto/polling.h which was not used anymore 2007-04-09 15:28:51 +02:00
Willy Tarreau
1e63130a37 [MAJOR] implemented support for FreeBSD's kqueue() polling mechanism
It has not been tested yet, but at least it builds.
2007-04-09 12:03:06 +02:00
Willy Tarreau
e54e9176a3 [MINOR] ev_* : moved the poll function closer to fd_* 2007-04-09 09:23:31 +02:00
Willy Tarreau
97129b5408 [MINOR] changed fd_set*/fd_clr* functions to return ints
The fd_* functions now return ints so that they can be
factored when appropriate.
2007-04-09 00:54:46 +02:00
Willy Tarreau
28d86862bc [MEDIUM] pollers: store the events in arrays
Instead of managing StaticReadEvent/StaticWriteEvent, use evts[dir]
2007-04-08 17:42:27 +02:00
Willy Tarreau
663193882a [MEDIUM] factor FD_ISSET/FD_CLR and !FD_ISSET/FD_SET
Use the new FD_COND_C/FD_COND_S macros to reduce the number of
operations during tests and sets.
2007-04-08 17:17:37 +02:00
Willy Tarreau
f161a34fb3 [MEDIUM] updated all files to use EV_FD_*
Removed the temporary dirty hack.
2007-04-08 16:59:42 +02:00
Willy Tarreau
4f60f16dd3 [MAJOR] modularize the polling mechanisms
select, poll and epoll now have their dedicated functions and have
been split into distinct files. Several FD manipulation primitives
have been provided with each poller.

The rest of the code needs to be cleaned to remove traces of
StaticReadEvent/StaticWriteEvent. A trick involving a macro has
temporarily been used right now. Some work needs to be done to
factorize tests and sets everywhere.
2007-04-08 16:39:58 +02:00
Willy Tarreau
b3107b9383 [MINOR] pollers should not use MY_FD_* 2007-04-08 09:32:47 +02:00
Willy Tarreau
42c7659669 [RELEASE] Released version 1.3.8.2 with the following changes :
- rewriting either the status line or request line could crash the
      process due to a pointer which ought to be reset before parsing.
    - rewriting the status line in the response did not work, it caused
      a 502 Bad Gateway due to an erroneous state during parsing
2007-04-03 20:30:13 +02:00
Willy Tarreau
a9bd19853e [BUG] initialize msg->sol before parsing first line
Before calling http_parse_{sts,req}line(), it is necessary
to make msg->sol point to the beginning of the line. This
was not done, resulting in the proxy sometimes crashing when
URI rewriting or result rewriting was used.
2007-04-03 20:03:18 +02:00
Willy Tarreau
02785764a4 [BUG] Status line in HTTP response could not be rewritten
Typo implied use of HTTP_MSG_RQMETH state instead of HTTP_MSG_RPVER.
2007-04-03 14:45:44 +02:00
Willy Tarreau
1e443e9084 [CONTRIB] the URLs in the SPEC files were obsolete 2007-04-01 11:37:02 +02:00
Willy Tarreau
ef6d7612d6 [RELEASE] Released version 1.3.8.1 with the following changes :
- fix reqadd when no option httpclose is used.
    - removed now unused fiprm and beprm from proxies
    - split logs into two versions : TCP and HTTP
    - added some docs about http headers storage and acls
    - added a VIM script for syntax color highlighting (Bruno Michel)
2007-04-01 11:06:22 +02:00
Willy Tarreau
f40110248b [CONTRIB] added the 'except' keyword to haproxy.vim 2007-04-01 11:05:06 +02:00
Willy Tarreau
5e47a72f34 [CONTRIB] added a VIM script for syntax coloring 2007-04-01 10:09:10 +02:00
Willy Tarreau
985fc56734 [DOC] added some docs about http headers storage and acls 2007-04-01 09:44:10 +02:00
Willy Tarreau
422505801f [MEDIUM] splitted logs into two versions : TCP and HTTP
logs are handled better with dedicated functions. The HTTP implementation
moved to proto_http.c. It has been cleaned up a bit. Now a frontend with
option httplog and no log will not call the function anymore.
2007-04-01 01:30:43 +02:00
Willy Tarreau
e2e27a5c8d [MEDIUM] removed now unused fiprm and beprm from proxies
The fiprm and beprm were added to ease the transition between
a single listener mode to frontends+backends. They are no longer
needed and make the code a bit more complicated. Remove them.
2007-04-01 00:01:37 +02:00
Willy Tarreau
f2f0ee81ad [BUG] fix reqadd when no option httpclose is used.
Due to a code indentation mismatch, the rspadd headers were only
added if option httpclose was not set.
2007-03-30 12:02:43 +02:00
Willy Tarreau
d661cc06af [RELEASE] Released version 1.3.8 with the following changes :
- fixed several bugs which might have caused a crash with bad configs
    - several optimizations in header processing
    - many progresses towards transaction-based processing
    - option forwardfor may be used in frontends
    - completed HTTP response processing
    - some code refactoring between request and response processing
    - new HTTP header manipulation functions
    - optimizations on the recv() patch to reduce CPU usage under very
      high data rates.
    - more user-friendly help about the 'usesrc' keyword (CTTPROXY)
    - username/groupname support from Marcus Rueckert
    - added the "except" keyword to the "forwardfor" option (Bryan German)
    - support for health-checks on other addresses (Fabrice Dulaunoy)
    - makefile for MacOS 10.4 / Darwin (Dan Zinngrabe)
    - do not insert "Connection: close" in HTTP/1.0 messages
2007-03-26 00:24:56 +02:00
Willy Tarreau
0b4ed90de4 [BUILD] cfgparse requires errno.h on OpenBSD. 2007-03-26 00:18:40 +02:00
Willy Tarreau
2807efdb02 [MEDIUM] do not add Connection: close in HTTP/1.0 mode
If we already are in HTTP/1.0 and if no connection: has been seen,
it is not necessary to add Connection: close.
2007-03-25 23:47:23 +02:00
Willy Tarreau
5eb0917954 [DOC] added a CONTRIB file
Most useful contributions are acknowledged in this file.
2007-03-25 22:56:04 +02:00
Willy Tarreau
f2b74c26c5 [CLEANUP] added a few missing newlines to the HTML report
Sometimes it is preferable that the HTML output can be parsed.
Ensure better use of the newlines for this.
2007-03-25 22:44:08 +02:00
Willy Tarreau
417fae0e60 [MINOR] changed server weight storage from char to unsigned int
This change does not affect memory usage much, but it simplifies the
code a lot by removing many +1/-1 operations on weights.
2007-03-25 21:16:40 +02:00
Willy Tarreau
91b6f329eb [CLEANUP] slightly reorganized the struct server
Struct server has gathered lots of informations over the time, but
it's better for clarity and performance to group those information
by usage, the most common ones at the top and the least ones at the
bottom.
2007-03-25 21:03:01 +02:00
Willy Tarreau
0f03c6f60b [MINOR] cleaned up the check_addr patch a bit
removed useless set_check_addr entry and rely on check_addr itself.
2007-03-25 20:46:19 +02:00
Willy Tarreau
cec2e7ad1c [BUILD] makefile for MacOS 10.4 / Darwin
Contribution from Dan Zinngrabe :

Here is a Makefile based on that for BSD that builds HAProxy 1.3.7 on
MacOS 10.4 and Darwin. I haven't tested it extensively yet, but it
does seem to work so far.
2007-03-25 16:55:56 +02:00