Solved

Setting up Linux IMAP with MySQL

Posted on 2012-03-18
7
387 Views
Last Modified: 2012-03-24
I have a Debian server running Postfix and Courier for IMAP.  Currently, my mail queue is /Maildir.  The problem is that we've added over 50 users to the server (company acquisition) since putting in this machine.  Users are complaining that the machine is slow.  One suggestion from someone was setting up MySQL to hold the email instead of putting the email in /Maildir.  I've been trying to find articles to set this up but it looks like the only articles I find talk about setting up a users table in MySQL, not putting email in the database itself.  I'd prefer to go to Exchange, but the cost of CALs for these users (143 total including the 50) is more money than my company wants to spend.  I'm not worried about the server hardware itself.  That is one powerhorse machine.  So I wanted to see what anyone had suggestion-wise for scaling up this system.
0
Comment
Question by:sedberg1
7 Comments
 
LVL 19

Expert Comment

by:bevhost
ID: 37736124
Eve a modest server should be able to handle many more than 50 Mailboxes,
although, I guess it depends on the size of each mailbox.

I would think that MySQL may make it even slower, but this is just a feeling as I have never tried this.

To switch to MySQL as a storage engine requires changes to the mail reader (IMAP/Courier/Dovecot) and the mail delivery agent (SMTP/Postfix/postdrop)

I would try other IMAP servers before changing mailbox format.

Have you tried Dovecot or Cyrus?

Do some googling to see if you can find some speed comparisons
eg
http://objectmix.com/imap/729546-fastest-imap-server.html
0
 
LVL 19

Expert Comment

by:bevhost
ID: 37736133
Do you have enough RAM?
Can you tweak the IMAP server for more caching?
0
 

Expert Comment

by:ajaydata
ID: 37745568
If you are running on Linux, try vmstat 1 and see whether your IO is becoming bottleneck. Most of th times  its not about number of users , it may b because of email traffic and mail size which causes lots of IO an slows don the system.

You may want to download www.xgen.in , It gives you flexibility to store mails as Normal
 File storage or in database. It also allows you to control the IMAP service user wise and alo allows you to create separate table for each user for mail storage.

Hope it helps.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:sedberg1
ID: 37755267
I can't use Xgen.  It costs money.  I don't have a budget for this.

Could someone give me pointers or a link to site on how to get done what I'm trying to do?  Does anyone know how to set up MySQL as a the database engine to store emails?
0
 
LVL 19

Accepted Solution

by:
bevhost earned 500 total points
ID: 37755627
http://www.dbmail.org/
DBMail is an open-source project that enables storage of mail messages in a relational database.
Currently MySQL, PostgreSQL, Oracle, and SQLite can be used as storage backends.
Commercial development and support is also available.


Scalability
Dbmail is as scalable as the database system used for storage.
Manageability
Dbmail can be managed by updating the relational database or directory service - without shell access.
Speed
Dbmail uses very efficient, database specific queries for retrieving mail information.
Security
Dbmail doesn't require filesystem access. It's as secure as the database and directory server used.
Flexibility.
Changes in a Dbmail system (adding of users, changing passwords etc.) are effective immediately. Users can be stored in the database, or managed separately in an LDAP server such as OpenLDAP or Active Directory.


DBMail is made up of several components. A normal MTA (Postfix, SendMail, QMail, Exim) is used for accepting messages. The MTA hands the messages over to dbmail-deliver, using a pipe interface, or to dbmail-lmtpd, using LMTP (Local Mail Transport Protocol).

These programs take care of injecting the message into the database. Messages can be retreived from the database using dbmail-pop3d, using the POP3 protocol, or dbmail-imapd, using the IMAP4Rev1 protocol.

Emails are stored in the database. This includes attachments. User information is also stored in the database, so users do not need a system account on machines DBMail is running on.
0
 
LVL 3

Expert Comment

by:rickygm
ID: 37759379
Hi ,  in linux never I have seen a mail server that keeps mailboxes in a db, I believe that serious very unstable one, if you have users who have a high volume of email in their mailbox , the best thing is than it handles your file system to it

dovecot + Maildir is good for high volume of emails , and and an amount of ram memory can be your help ...

check about this

http://wiki.dovecot.org/MailboxFormat/Maildir
0
 
LVL 19

Expert Comment

by:bevhost
ID: 37759568
I think you are asking the wrong question here.
You should be asking why your imap / maildir is perfomrinc so badly rather than trying to use SQL as a storage engine.  Chances are that it won't solve your problem.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now