Feature #2171

Solaris event-ports support

Added by mm over 4 years ago. Updated over 3 years ago.

Status:FixedStart date:2010-03-10
Priority:NormalDue date:
Assignee:stbuehler% Done:

100%

Category:core
Target version:1.4.29
Missing in 1.5.x:Yes

Description

This is a reworked 2-year-old patch of #1147 with only little modifications, diffed against lighttpd 1.4.26.

Solaris Event Ports are currently the best polling mechansim on Solaris 10 and OpenSolaris.

Configuration file:
server.event-handler = "solaris-eventports"

You may change the event handler name to "solaris-port" as in the original patch (but this one is more declarative).

The patch works on my Solaris 10 systems under high load and in comparsion to solaris-devpoll does not eat up a whole CPU core.

If you consider adding this patch to the core, please close issue #1147

Martin Matuska.

solaris-eventports-1.4.26.diff Magnifier - Event Ports support for 1.4.26 (16.2 KB) mm, 2010-03-10 00:31

solaris-eventports-1.4.26.diff Magnifier - Updated Event Ports patch for 1.4.26 (16.7 KB) mm, 2010-03-10 14:54

solaris-eventports.patch Magnifier (10.6 KB) mm, 2011-03-13 19:46

fdevent-add-solaris-eventports.patch Magnifier (9.9 KB) stbuehler, 2011-06-13 14:35


Related issues

Related to Feature #1147: Solaris Event Ports Fixed

Associated revisions

Revision 2796
Added by stbuehler over 3 years ago

fdevent: add solaris eventports (fixes #2171)

History

#1 Updated by mm over 4 years ago

Running on a busy server (single process) with 4000+ connections, 3000+ requests/sec, 200+Mbit/s traffic.
Server load with poll module: 0.7, with event ports: 0.5 (~50% of one core)

#2 Updated by mm over 4 years ago

From client's perspective connections are handled properly and data is delivered properly.

But when connections are closed, the following appears in the error log:
2010-03-10 11:06:22: (connections.c.1216) connection closed: poll() -> ERR [number]

We can do this in connections.c:

diff -Naur ../lighttpd-1.4.26.orig/src/connections.c ./src/connections.c
--- ../lighttpd-1.4.26.orig/src/connections.c   2010-03-10 11:18:02.173041427 +0100
+++ ./src/connections.c 2010-03-10 11:19:24.161434445 +0100
@@ -1212,7 +1212,7 @@

                        }
                } else if (revents & FDEVENT_ERR) {
-#ifndef USE_LINUX_SIGIO
+#if !defined(USE_LINUX_SIGIO) && !defined(USE_SOLARIS_PORT)
                        log_error_write(srv, __FILE__, __LINE__, "sd",
                                        "connection closed: poll() -> ERR", con->fd);
 #endif

#3 Updated by mm over 4 years ago

#4 Updated by mm over 4 years ago

  • Status changed from New to Patch Pending

#5 Updated by nitrox over 4 years ago

  • Missing in 1.5.x changed from No to Yes

#6 Updated by stbuehler over 4 years ago

  • Target version changed from 1.4.27 to 1.4.x

#7 Updated by stbuehler about 4 years ago

  • Status changed from Patch Pending to Missing Feedback
  • Target version deleted (1.4.x)

I just committed the libev fdevent handler; that should include support for solaris-eventports too.

If you'd still like a native solaris-port handler, please update your patch to:
  • use log* functions (see other backends) instead of fprintf
  • don't include the diffs for generated files like: config.h.in, configure, Makefile.in

Just reopen the bug in that case, thx.

#8 Updated by mm over 3 years ago

  • File solaris-eventports.patchMagnifier added
  • Status changed from Missing Feedback to Reopened
  • Assignee set to stbuehler
  • Target version set to 1.4.29

I have updated the native eventports patch following your instructions and running it successfully on Solaris 10, OpenSolaris and Nexenta Core.

#9 Updated by Olaf-van-der-Spek over 3 years ago

What's the advantage over using libev?

#10 Updated by stbuehler over 3 years ago

what is the && defined(__sun) needed for?

#11 Updated by mm over 3 years ago

That is probably remains from the old patch, I don't think it is necessary.

#12 Updated by stbuehler over 3 years ago

Ok, next question: why call port_getn twice?

#13 Updated by stbuehler over 3 years ago

stbuehler wrote:

Ok, next question: why call port_getn twice?

Hm, i think i get that now.

But i don't like the handling of ETIME, according to the man page http://compute.cnr.berkeley.edu/cgi-bin/man-cgi?port_getn+3:

     ETIME     The time  interval  expired  before  the  expected
               number  of  events  have  been  posted to the port
               (original value in nget), or nget is updated  with
               the  number of returned port_event_t structures in
               list[].

This doesn't sound like one could rely on nget, or you should at least compare it to the value you provided, and only proceed when they are different.

#14 Updated by stbuehler over 3 years ago

Here the patch i would use; as opensolaris is a pain in the ass i didn't manage to test it.

#15 Updated by mm over 3 years ago

Hi, to compile, the patch is missing a int declaration:
for (i = 0; i < available_events; ++i) {
solaris_port_events = 0;
should be:
for (i = 0; i < available_events; ++i) {
int solaris_port_events = 0;

Second, it doesn't work (lighttpd doesn't server a single file). The previous patch works.

I can do one or more of these things:
a) help you debug this
b) provide you access to a machine with a working build environment
c) provide you with a virtualbox appliance with a working build environment

Thank you for looking at this,
Martin Matuska

#16 Updated by stbuehler over 3 years ago

solaris_ports_events = 0; can be removed (the var isn't needed, the flags are read from user_data). wait_for_events should perhaps be initialized to 0.

Apart from that it should work (as long as it compiles).

If it doesn't, well... i guess for all 3 options it would be helpful if you could join #lighttpd@freenode

Whether it works or not, i'm especially interested in compiler warnings :)

#17 Updated by stbuehler over 3 years ago

  • Status changed from Reopened to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2796.

Also available in: Atom