Pen 0.27.0 released

Available here:

And also here:

The 0.27.0 release focuses on doing more by doing less. The number of syscalls
required per transaction has been reduced significantly. On Linux, 100 ApacheBench
requests using all default Pen settings took 5689 syscalls on 0.26.1, but only
2819 on 0.27.0 (2413 with tcp_fastclose).

Another way of doing less has been to move certain operations from O(n) to O(1),
where n is the number of connections. That doesn’t matter much with the default
256 simultaneous connections, but when n is 100000, it makes a difference.

Two new configuration commands have seen the light of day. These can be set
on the command line at startup or dynamically with penctl.

tcp_nodelay|no tcp_nodelay

This controls the TCP_NODELAY option on sockets, which turns the Nagle algorithm
on or off on supported systems. May or may not make a difference.
Default is no tcp_nodelay.

tcp_fastclose up|down|both|off

With Pen being a proxy, one Pen connection is actually two TCP connections,
one to the client and one to the server. Normally, Pen waits for both client
and server to signal end of file before shutting down the connection.
For some protocols this is not necessary and it is safe to shut down the
connection when either end does. Default is off.

Finally, it is no longer required to run the configure script when
cross-compiling for Windows.

All ChangeLog entries since 0.26.1:

150212 Added with reasonable settings for Windows.

150211 Better detection and blacklisting of unavailable servers.

150209 New penctl commands:
tcp_nodelay sets TCP_NODELAY on sockets. Turn off with no tcp_nodelay.
tcp_fastclose closes both upstream and downstream sockets if one of them
closes theirs. Will take the values up, down, both or off (default).

150208 Rather than making a table of pending connections every time through
the main loop, keep them in a doubly linked list which is only updated
as needed. O(n) -> O(1).

150207 A bug in udp mode: after successful “connect”, do not event_add downfd,
because it is equal to listenfd and epoll_ctl doesn’t like that.

150206 Module kqueue.c updated.
Module poll.c: set unused fd:s to -1, or Solaris will say ENOSYS.

150205 Enable diagnostic messages by default in
Changed event bookkeeping from stateless to stateful.
Made keepalive optional and added “keepalive / no keepalive” penctl command.


2 thoughts on “Pen 0.27.0 released

  1. hello

    I am trying to test pen.
    I meet a trouble to put a control port with the -C option, the server is not listening on the port that I provided.

    pen -C localhost: 10080 -r 5140
    penctl localhost: 10080 listen
    error connecting to server

    And when I verified with netstat, I can not see the open port.

    An idea?

    PS: I test with centos 6 and 7

    1. The easiest way to troubleshoot the command line is to run Pen in the foreground with debugging enabled. I ran your command like this:

      ./pen -ddf -C localhost: 10080 -r 5140 2> log

      And found this near the top of the log:

      2015-02-19 00:26:36: socket returns 3, socket_errno=0
      2015-02-19 00:26:36: local address=[localhost:0]

      So that’s the control socket listening on tcp port 0. I believe that you meant to use localhost:10080, but accidentally put a space between localhost: and 10080. When I start Pen like this, it works fine:

      ./pen -ddf -C localhost:10080 -r 5140 2> log

      penctl localhost:10080 listen

      I’ll add a sanity check for the port number, so there will be a diagnostic message if it’s unreasonable.

Leave a Reply

Your email address will not be published. Required fields are marked *