Commit Graph

146 Commits

Author SHA1 Message Date
Willy Tarreau
cf7f320f9d [MAJOR] last bunch of capture changes for mempool v2
The header captures had lots of pools. They have all been transformed.
2007-05-13 22:46:04 +02:00
Willy Tarreau
086b3b4c9f [MAJOR] ported the captures to use the new mempool v2
The "capture.c" file has also been removed since it was empty.
2007-05-13 21:45:51 +02:00
Willy Tarreau
332f8bfc5b [MAJOR] ported requri to use mempools v2 2007-05-13 21:36:56 +02:00
Willy Tarreau
63963c62e7 [MAJOR] ported appsession to use mempools v2
Also during this process, a bug was found in appsession_refresh().
It would not automatically requeue the task in the queue, so the
old sessions would not vanish.
2007-05-13 21:29:55 +02:00
Willy Tarreau
e4d7e55061 [MAJOR] ported pendconn to mempools v2
A pool_destroy() was also missing in deinit()
2007-05-13 20:19:55 +02:00
Willy Tarreau
7341d94c5d [MAJOR] switched buffers to mempools v2 2007-05-13 19:56:02 +02:00
Willy Tarreau
c6ca1a02aa [MAJOR] migrated task, tree64 and session to pool2
task and tree64 are already very close in size and are merged together.
Overall performance gained slightly by this simple change.
2007-05-13 19:43:47 +02:00
Willy Tarreau
e6ce59deb7 [MEDIUM] add new memory management functions
Implement pool_destroy2, pool_flush2, pool_gc2. It is safe to call
pool_gc2 to free whatever memory possible.
2007-05-13 19:38:49 +02:00
Willy Tarreau
50e608d721 [MEDIUM] implement memory pools version 2
The new pools know about their size and usage. Malloc is not used
anymore, instead a dedicated function to refill the entries is used.
2007-05-13 18:26:08 +02:00
Willy Tarreau
0481c20e66 [MINOR] add new tv_* functions
The most useful, tv_add_ifset only adds the increment if it is set. It
is designed for use in expiration computation.
2007-05-13 16:03:27 +02:00
Willy Tarreau
d825eef9c5 [MAJOR] replaced all timeouts with struct timeval
The timeout functions were difficult to manipulate because they were
rounding results to the millisecond. Thus, it was difficult to compare
and to check what expired and what did not. Also, the comparison
functions were heavy with multiplies and divides by 1000. Now, all
timeouts are stored in timevals, reducing the number of operations
for updates and leading to cleaner and more efficient code.
2007-05-12 22:35:00 +02:00
Willy Tarreau
49fa3a1453 [MINOR] time.h: added a few tv_* functions to manipulate timevals
A few more tv_* functions will be needed to switch from a millisecond-based
scheduler to a struct timeval-based one.
2007-05-12 22:29:44 +02:00
Willy Tarreau
9ca931f976 [RELEASE] Released version 1.3.10.2 with the following main changes :
- fixed build of files including standard.h on OpenBSD
2007-05-10 07:51:17 +02:00
Willy Tarreau
938b303a04 [BUILD] fixed build of files including standard.h on OpenBSD
The file standard.h included netinet/in.h without including
sys/types.h. This broke build on OpenBSD.
2007-05-10 06:39:03 +02:00
Willy Tarreau
13398d3896 [RELEASE] Released version 1.3.10.1 with the following main changes :
- fixed sepoll transition matrix (two states were missing)
2007-05-09 22:58:28 +02:00
Willy Tarreau
61beedfb8c [RELEASE] Released version 1.3.10 with the following main changes :
- several fixes in ev_sepoll
    - fixed some expiration dates on some tasks
    - fixed a bug in connection establishment detection due to speculative I/O
    - fixed rare bug occuring on TCP with early close (reported by Andy Smith)
    - implemented URI hashing algorithm (Guillaume Dallaire)
    - implemented SMTP health checks (Peter van Dijk)
    - replaced the rbtree with ul2tree from old scheduler project
    - new framework for generic ACL support
    - added the 'acl' and 'block' keywords to the config language
    - added several ACL criteria and matches (IP, port, URI, ...)
    - cleaned up and better modularization for some time functions
    - fixed list macros
    - fixed useless memory allocation in str2net()
    - store the original destination address in the session
2007-05-09 01:44:58 +02:00
Willy Tarreau
23677908dd [MEDIUM] implement SMTP health checks
Peter van Dijk contributed this patch which implements the "smtpchk"
option, which is to SMTP what "httpchk" is to HTTP. By default, it sends
"HELO localhost" to the servers, and waits for the 250 message, but it
can also send a specific request.
2007-05-08 23:50:35 +02:00
Willy Tarreau
f3d259868b [MINOR] ACL regex matching on the URI ; uri_reg
The URI can be matched on regexen now. The upcase/lowcase flag
can not be set yet and will soon have to.
2007-05-08 23:24:51 +02:00
Willy Tarreau
a67fad9d68 [MINOR] implement acl_parse_ip and acl_match_ip
The ACL can now compare IP addresses. The client's IP address
can be checked.
2007-05-08 23:24:51 +02:00
Willy Tarreau
5c8e3e09e9 [MEDIUM] added the 'block' keyword to the config language
The new 'block' keyword makes it possible to block a request based on
ACL test results. Block accepts two optional arguments : 'if' <cond>
and 'unless' <cond>.

The request will be blocked with a 403 response if the condition is validated
(if) or if it is not (unless). Do not rely on this one too much, as it's more
of a proof of concept helping in developing other matches.
2007-05-08 23:24:51 +02:00
Willy Tarreau
eb0c614f0e [MEDIUM] add the 'acl' keyword to the config language
The 'acl' keyword allows one to declare a new ACL. It is an important part
of the ACL framework.
2007-05-08 23:24:50 +02:00
Willy Tarreau
a84d374367 [MAJOR] new framework for generic ACL support
This framework offers all other subsystems the ability to register
ACL matching criteria. Some generic matching functions are already
provided. Others will come soon and the framework shall evolve.
2007-05-08 23:24:50 +02:00
Willy Tarreau
14c8aac63b [MEDIUM] store the original destination address in the session
There are multiple places where the client's destination address is
required. Let's store it in the session when needed, and add a flag
to inform that it has been retrieved.
2007-05-08 23:24:20 +02:00
Willy Tarreau
d077a8e67c [MINOR] fixed useless memory allocation in str2net()
It was not necessary anymore to allocate memory in str2net().
Moreover, some calls to free() were missing in case of errors.
2007-05-08 23:23:38 +02:00
Willy Tarreau
3ff3dc1fb1 [MINOR] add support for variable size arrays in structures
Depending on the version of GCC, variable size arrays are not
declared in the same manner. Let's add a check for the version
and provide a macro.
2007-05-08 14:08:05 +02:00
Willy Tarreau
2b1dccd501 [MINOR] add LIST_HEAD_INIT to the list management macros
It is useful to have the ability to initialize a list while declaring it.
2007-05-08 14:07:44 +02:00
Willy Tarreau
b9c62b90da [MEDIUM] add better list management macros
The FOREACH_ITEM and FOREACH_ITEM_SAFE macros are nasty, they
require too many arguments. Let's port those from linux instead.
2007-05-08 14:07:39 +02:00
Willy Tarreau
2fcb500481 [MEDIUM] implement the URI hash algorithm
Guillaume Dallaire contributed the URI hashing algorithm for
use with proxy-caches. It provides the advantage of optimizing
the cache hit rate.
2007-05-08 14:05:27 +02:00
Willy Tarreau
9cdde230a5 [MEDIUM] always have msg->sol point to beginning of message
Since the 'data' pointer is not stored in message structures, it is
useful to have such a pointer to it when the message has been fully
parsed.
2007-05-08 14:05:14 +02:00
Willy Tarreau
e33aecefa6 [MINOR] uninline task_wakeup
task_wakup has become bigger since we used the trees. Let's not
inline it anymore.
2007-04-30 14:38:03 +02:00
Willy Tarreau
42aae5c7cf [MEDIUM] many cleanups in the time functions
Now, functions whose name begins with '__tv_' are inlined. Also,
'tv_ms' is used as a prefix for functions using milliseconds.
2007-04-29 17:43:56 +02:00
Willy Tarreau
8d7d1497e0 [MEDIUM] implement and use tv_cmp2_le instead of tv_cmp2_ms
tv_cmp2_ms handles multiple combinations of tv1 and tv2, but only
one form is used: (tv1 <= tv2). So it is overkill to use it everywhere.
A new function designed to do exactly this has been written for that
purpose: tv_cmp2_le. Also, removed old unused tv_* functions.
2007-04-29 13:44:43 +02:00
Willy Tarreau
a6a6a93e56 [MAJOR] changed TV_ETERNITY to ~0 instead of 0
The fact that TV_ETERNITY was 0 was very awkward because it
required that comparison functions handled the special case.
Now it is ~0 and all comparisons are performed on unsigned
values, so that it is naturally greater than any other value.

A performance gain of about 2-5% has been noticed.
2007-04-29 13:44:24 +02:00
Willy Tarreau
96bcfd75aa [MAJOR] replaced rbtree with ul2tree.
The rbtree-based wait queue consumes a lot of CPU. Use the ul2tree
instead. Lots of cleanups and code reorganizations made it possible
to reduce the task struct and simplify the code a bit.
2007-04-29 13:43:53 +02:00
Willy Tarreau
3fa095d542 [MINOR] removed useless counters from ul2tree_insert()
node_right_lookup and node_right_lookup were two statistical counters.
Let's remove them as we do not need them.
2007-04-29 13:43:03 +02:00
Willy Tarreau
be384c6354 [MINOR] import ul2tree from old librt project
This is an import of the old ul2tree code as well as required bitops.
All of them will have to be refreshed at one moment.
2007-04-29 13:41:57 +02:00
Willy Tarreau
40cf67da89 [MINOR] added support for dual-linked lists
Imported dual-linked lists management macros from the old scheduler project,
and fixed a long-standing nasty bug in the DLIST_ADD() macro.
2007-04-29 13:40:50 +02:00
Willy Tarreau
6e0433f0e9 [RELEASE] Released version 1.3.9 with the following changes :
- modularized the polling mechanisms and use function pointers instead
      of macros at many places
    - implemented support for FreeBSD's kqueue() polling mechanism
    - fixed a warning on OpenBSD : MIN/MAX redefined
    - change socket registration order at startup to accomodate kqueue.
    - several makefile cleanups to support old shells
    - fix build with limits.h once for all
    - ev_epoll: do not rely on fd_sets anymore, use changes stacks instead.
    - fdtab now holds the results of polling
    - implemented support for speculative I/O processing with epoll()
    - remove useless calls to shutdown(SHUT_RD), resulting in small speed boost
    - auto-registering of pollers at load time
2007-04-16 01:33:37 +02:00
Willy Tarreau
5b7024270a [BUILD] regparm in fd.h broke build on gcc-2.95
It was necessary to put the attribute after the type.
2007-04-16 01:33:26 +02:00
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
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
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
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
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