Solved

Setting up Linux IMAP with MySQL

Posted on 2012-03-18
7
396 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
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…

856 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