[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views - __init__.py:1.1 configure.zcml:1.1

Stephan Richter stephan.richter@tufts.edu
Wed, 30 Oct 2002 13:08:24 -0500


> > Yes, Shane and I worked in March on a replacement for Medusa and it is in
> > use since then. The architecture is really nice and pluggable. In fact,
> > the FTP and HTTP server that come with Zope, work out of the box simply
> > with the Filesystem. We have not replaced the old asyncore module, since
> > it was too much work, but that is just a task pending.
>
> Can you elaborate on this please? Is asyncore is use or not? If it is, then
> what was all the work you guys did?

asyncore.py is still in use, since we did not have the time to replace it. 
Shane liked the Twisted approach to asyncore, so we wanted to glean at it for 
some ideas, but as said, this is still open.

What did we actually do? Everything else. We basically threw Medusa away and 
reimplemented the servers more component. First of all, we wrote interfaces 
for all of the code, which makes it already much better to understand how to 
implement a protocol. We wrote a LineReceiver Base Server for line based 
protocols, such as SMTP (see 
http://cvs.zope.org/Zope3/lib/python/Zope/Server/SMTP/Attic/SMTPServerChannel.py?rev=1.1.2.6&content-type=text/vnd.viewcvs-markup 
to see how short the code can be) and FTP (except data transfer). We also 
implemented a Virtual File System (VFS), which is able to display the ZODB as 
a filesystem. This way you only need to implement a VFS view for your content 
object and all FS representations (FTP, WebDAV, ...) will know how to use it. 
In the same move we also made many, many Pulisher/Publication changes, so 
that the code became much cleaner. 

Here some of the checkin messages:
Issue 53: Comment

- Created a bunch of interfaces that let us know what is going on.
- Split, updated and zopefied the Logger code.
- Reorganized dir structure in Zope.Server
- HTTP component split up in files (HTTP server works)
- Inserted Shane's skeleton FTP code (since I like his better than mine)
- Took a first cut at the Virtual File System (VFS) by copying and updating
  medusa'a old filesys.py code.

- Factored the non-HTTP-specific code into ServerBase, in preparation for
  an FTP server.

> > Shane and I looked at Twisted and decided that it was not suitable for
> > the Zope 3 default servers (I do not want or plan to explain the
> > reasonings here).
>
> Why not? ;-)

Short answer: There are problems (lock-ups) with long-living transactions that 
need thread support. 
Long answer: I don't have time for that. :-)

Here the IServer doc string:
    """This interface describes the basic base server.

       The most unusual part about the Zope servers (since they all
       implement this interface or inherit its base class) is that it
       uses a mix of asynchronous and thread-based mechanism to
       serve. While the low-level socket listener uses async, the
       actual request is executed in a thread.  This has the huge
       advantage that if a request takes really long to process, the
       server does not hang at that point to wait for the request to
       finish.
    """
In fact, your server can be smart about it too. For the FTP server for 
example, we chose the commands that should use threads and which do not. For 
example TYPE will always be a fast, short command, so we do not open a 
thread. For LIST on the other hand, it might take a while and we do not want 
to block the server till it is done collecting information, so another thread 
is opened.

> >>Do we even need an integrated Web server to begin with?
> >>We're told it makes it easy to set up "out of the box".
>
> This is somethign I'm curious about too, Apache is a pretty good web
> server, why can't we just use that?

Well, all you need is to write a couple of components for it. You basically 
need to redirect Apache straight to the Publisher.

> But it adds a pretty hefty development burden to have a web server. Look at
> the huge number of DOS and other attacks still open if you _don't_ run Zope
> behind Apache. The concept of running one web server behind another also
> confuses a lot of people.

Well, I have a lot of development instances plus a couple of public sites only 
running the Zope server and I really like it, since there is not much setup 
required.

> Extensible is good, but we actually need a platform for any growth ;-)
> I'm very much in favour of getting a very small, tight core up and running
> so we can actually start using it for things rather than developing a
> massive white elephant.

Yep, I agree.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training