Topic: postfix for messaging

I am engaged in writing another social network type application and as part of this app I am doing facebook style private messaging.

I am considering using postfix as the backbone to the service and closing it down so it only routs mail to the local network and uses virtual users etc

Am I crazy to do this? What is the benifit over implementing my own messaging API using MySQL and PHP??

It would be nice to hear some thoughts on this.

Re: postfix for messaging

If the messages are only sent within your application, that seems like overkill; you could just directly create messages in the receivers inbox instead. If sending emails is actually what you want, then yes, using postfix like that would work nicely.

Give us more details about your architecture, and we might provide more detailed comments.

Re: postfix for messaging

Hi, thanks for the reply.

I am expected to be able to support a huge user base, something in the region of 1.5 to 2 million users.

I am creating a distributed server architecture with load balanced webserver cluster, database servers etc and a separate mail server or servers to handle the messaging. The reason for choosing a mail server to do the messaging is because at some point in the future the server cluster will have to be duplicated into several countries and a mail server seemed to me to be an ideal choice to route messages between each node, since that is what they are designed for. The fact that the system is sending email will be hidden from the users as it will appear like the private messages in Facebook, with threaded view etc.

I could implement a bespoke system using a database and database replication and some simple client but then I would miss out on the decades of experience that has gone into development of a mail server.

Re: postfix for messaging

Ah, I see. I can't really say that I have much (well, any) experience on that scale. I'm thinking that it can be done with mail servers, it's just a matter of installing enough hardware. However, the SMTP protocol (and the handling of mails by postfix internally) supports many more features that you're likely going to need for intra-site messaging (even between different instances of your service), which slows down processing (read: you'll spend more on hardware) and increases maintenance requirements and failure risk.

Then again, if you implement something of your own, you might end up with crappy software that is unreliable and limiting, or you might spend more on development than postfix's complexity would otherwise cost you.

One thing you might consider however is thinking of messages and their transport as separate. Define a message format that is suitable for eventual later transmission via SMTP without too much massaging, but as long as your installation is still small and limited to a single database instance, make the transport of messages as simple as you can (e.g., just write the message directly into the receiver's inbox upon creation/

Re: postfix for messaging

Yeah, that sounds like good advice.

A wise man once told me to plan for the numbers but don't jump through hoops until you have them.

As I am on a huge learning curve with mail servers i think i will opt for the latter option and create a simple, but not simplistic, custom messaging system that writes directly to a virtual mailbox in the database - i will stick to the structure postfix uses so i can more easily migrate if required at some later date - I like to call that Phase 2 :-)