1

I'm slowly setting up an email system on a Centos 7 server. The particular software I'm using will consist of postfix, dovecot and roundcube, although my question isn't specific to them (I think).

I've gotten to the point where postfix and dovecot are working and now I just need to add the webmail (roundcube). It occurred to me that instead of connecting it via a standard TCP/IP IMAP port I could instead use a unix socket. In theory, that should give me better performance/lower overhead, right? I could even close the port 143 entirely, forcing my users to use an encrypted connection (better security), while leaving the unencrypted socket for local access by the webmail (better performance). As far as I can tell, both dovecot and roundcube can be configured in this fashion, but there is no indication that anyone has ever attempted that. Why is that? Am I missing something?

2

I don't see how roundcube could be configured that way ? Docs suggest that $config['default_host'] is a hostname. Also probably squirrelmail uses php-imap, and imap_open clearly asks for server.

And imho wouldn't mean much for performance. That overhead ( on localhost ) doesn't mean much vs disk access or doing sorts and stuff

  • Well, I went by what this link says. – Vilx- Sep 1 '18 at 1:06
  • As for performance - well this thread says that unix sockets are significantly faster. However if it would really mean much for IMAP... I don't know. OTOH I suppose I can keep this in mind as a possible optimization for later, if it turns out to be necessary. The expected load on the server is low anyway, so likely it won't matter. – Vilx- Sep 1 '18 at 1:09
  • Interesting. But 99% of the time we need a tcp port open for IMAP anyway ( for mail clients ) , so i don't see why would you want to complicate your setup with an additional socket – Sandor Marton Sep 1 '18 at 12:38
  • Performance : the first answer from you link refers to FreeBSD and is very old ( from 2005 ) But check the 3rd answer, comparing Redis on sockets and tcp localhost. The difference is not that big, and even with big data size tcp throughput is over 10 gbps. Most of the time is over 100 gbps Disk throughputs are slower than that. Even PHP processing would be slower than that, since you don't transfer a lot of data So turning on/off PHP opcache for Roundcube would have a bigger impact ( from webmail ) that switching from tcp to sockets. – Sandor Marton Sep 1 '18 at 12:38
1

The only benefit of using a unix socket would be locking down access to localhost, but you can easily do that with a firewall rule. There will be zero visible performance benefit (as someone who has implemented an IMAP server, there is massive overhead in the protocol, and any benefit of not using TCP/IP would be utterly swamped by the protocol in any performance gains).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.