Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3FFF5ED74 for ; Tue, 15 Jan 2013 19:26:28 +0000 (UTC) Received: (qmail 13418 invoked by uid 500); 15 Jan 2013 19:26:27 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 13351 invoked by uid 500); 15 Jan 2013 19:26:27 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 13342 invoked by uid 99); 15 Jan 2013 19:26:27 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 19:26:27 +0000 Received: from localhost (HELO [192.168.23.9]) (127.0.0.1) (smtp-auth username markt, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 19:26:27 +0000 Message-ID: <50F5AD5F.8080703@apache.org> Date: Tue, 15 Jan 2013 19:26:23 +0000 From: Mark Thomas User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: APR, WebSocket and Servlet 3.1 NIO refactoring References: <50F559B9.3010901@apache.org> <1358266537.12507.7.camel@mail.remm.hd.free.fr> In-Reply-To: <1358266537.12507.7.camel@mail.remm.hd.free.fr> X-Enigmail-Version: 1.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Remy Maucherat wrote: >On Tue, 2013-01-15 at 13:29 +0000, Mark Thomas wrote: >> Hi, >> >> I think I am going to need to refactor the APR Poller code. Before I >get >> to far down that road I wanted to get a sanity check from those that >> understand the APR/native connector better than I do. >> >> The main problem: >> - I need to be able to update the flags for a socket current in the >> poller. For example, adding FLAGS_WRITE to a socket that currently >has >> FLAGS_READ >> >> Side issues: >> - APR connections don't track number of HTTP keep-alives left (it >gets >> reset every time the socket goes back to the Poller) >> - Currently we have two completely separate sets of Pollers. Once for >> Comet and one for non-Comet. >> >> The reasoning for the refactoring: >> >> 1. Sockets should only be added to a pollset once. >> 2. Because of 1) to update the flags the socket needs to be removed >from >> the pollset and re-added with the new flags. >> 3. Currently, we have no record of which Poller a socket is >registered >> with. This makes 2) more expensive as we have to iterate through the >> Pollers to find the socket. Tracking the current poller used by a >socket >> would make 2) a cheaper operation. >> 4. Implementing 3) requires maintaining a mapping from socket to >> SocketWrapper (like KeyAttachment does in NIO) >> 5. A simple Map of Socket->SocketWrapper should give us what we need. > >I had to solve each of these issues in the web container of JBoss. >Although this is not going to be quite 100% compatible with Tomcat, it >is very similar. > >I recommend looking at the branch that is in AS 7 trunk: >http://anonsvn.jboss.org/repos/jbossweb/branches/7.2.x/ Thanks. The more I look into this the more strangeness I find. I'll keep the above in mind if I need some pointers. >> In addition to enabling me to continue with the Servlet 3.1 NIO work, >> the other advantages to the proposed refactoring are: >> - Will be able to eliminate the CometPollers since the SocketWrapper >> knows if a request is Comet or not. >> - Proper tracking of HTTP keep-alive requests left per connection. >> >> If anyone can see a good reason not to start down this path, please >> speak up. > >With APR, I would keep a separate poller for events (called comet in >Tomcat) and keepalive, the code is rather different. At the moment they are almost identical. I'll see how things develop. Cheers, Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org