[Twisted-Python] irc server run by twisted and (probably) django

Rob Hoadley hoadley at gmail.com
Sat Oct 18 01:30:27 EDT 2008

I've done a similar type project but with a mailserver built using
twisted.mail. I used django.contrib.admin to help manage the db for
the mailserver config. From the mailservers, I was able to get by with
5 min Looping Calls to the database to build the required config data
and just cached the data until the next successful db call .  While
not entirely applicable to your problem,  I wanted to bring it up
because of the slightly different choice I made on how to gather data
out of the database. As the previous poster mentioned, I didn't want
to mess around with concurrency and decided that my mailservers (2 of
them now) would not care about each other and just get their config
data out of the database.

Where I also differ is I couldn't afford a sql query per each
connections MAIL FROM or RCPT TO. So I had to make it slightly more
flexible while still meeting the requirement of a database stored
config.  I basically choose a delayed Pull approach.  One upshot is I
coded the sql calls so that the config data survives a database
failure and just keeps working with it's previous data grab.  I also
coded a twisted.web service administration page that allows for a
manual reload of the data on the individual server if an emergency
came up and I absolutely needed the config to change.  It's a
different flavor you can use if you know your data is fairly static
and the number of people changing the data is low.

Now back to your problem... I've also used the spread toolkit before
(no not the twisted.spread.. and yes... OSS name collision). If I were
writing such an app, and thought I'd be using a number of servers for
the service; I'd consider using spread to keep things the same on all
servers and for anything else I needed quickly.  You'd still want a
database, you just aren't always using sql to pull data that you need.
 You are using the spread bus and your IRC twisted app (more likely a
service within your twisted app) is just listening for the data that
you deem high priority.   Commonly referred to as a Push approach.

Someone out there has done some work with spread and twisted.  I don't
know how well the code works. As for django, it'd be pretty easy to
send a spread message.

Hope you get some ideas.


On Thu, Oct 16, 2008 at 1:56 PM, Phil Christensen <phil at bubblehouse.org> wrote:
> On Oct 16, 2008, at 4:26 PM, Manuel Meyer wrote:
>> But I don't know how to inform IRCServer about changes in the site/db.
>> Maybe by adding another network protocol to the twisted application, where
>> django's signals could leave a note?
> I may be missing something, but if you keep all your data in the DB, there's
> no need to notify the irc server of changes to the DB.
> The only time you'll need this user information (it seems) is while
> responding to /join and /list requests. Just read the DB at that time.
> What's nice about this is the DB takes care of most if not all of your
> synchronization requirements, so you have far fewer concurrency issues to
> think about than if you were broadcasting changes from the web app to the
> irc server.
> -phil
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list