This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 6 and 7
Revision 6 as of 2007-01-08 15:20:13
Size: 1944
Editor: TimoSirainen
Comment:
Revision 7 as of 2007-04-03 04:53:40
Size: 2604
Editor: TimoSirainen
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The ''dictionary'' quota backend supports both '''storage''' and '''messages''' quota limits. The current quota is kept in a dictionary. Currently (as of 1.0.beta9 and later), the only supported dictionary backend is MySQL. The ''dictionary'' quota backend supports both '''storage''' and '''messages''' quota limits. The current quota is kept in a dictionary. Currently the only supported dictionary backend is MySQL.
Line 34: Line 34:
== Inaccuracy problems ==

Quota plugin doesn't currently track expunges entirely correctly. If two IMAP clients do an expunge at the same time, the quota is reduced twice as much. The other quota backends have the same problem, but it's not that big of a problem with them because they recalculate the quota once in a while anyway. Dict quota is recalculated only if the quota goes below zero.

So either you'll have to trust your users not to abuse this problem, or you could create a nightly cronjob to delete all rows from the SQL quota table to force a daily recalculation. The recalculation will of course slow down the server.

This problem will be fixed completely in later Dovecot versions.
Line 36: Line 44:
To avoid each process making a new SQL connection, you can make all dictionary communications go through a dictionary server process which keeps the connections permanently open. (1.0 RC1 and later) To avoid each process making a new SQL connection, you can make all dictionary communications go through a dictionary server process which keeps the connections permanently open.

Dictionary quota

The dictionary quota backend supports both storage and messages quota limits. The current quota is kept in a dictionary. Currently the only supported dictionary backend is MySQL.

The plugin parameter format is dict:<quota limits> <dictionary URI>. For example:

plugin {
  # 10MB and 1000 messages quota limit
  quota = dict:storage=10240:messages=1000 mysql:/etc/dovecot-dict-quota.conf
} 

However, the above example won't really work. This is because it would require linking all the binaries with MySQL library, which I didn't really want to do. Currently you'll have to do this via the dictionary proxy (see below). Actually the performance is better that way anyway, and I don't really see a reason not to use it.

Example dovecot-dict-quota.conf:

connect = host=localhost dbname=mails user=mailuser
table = quota
select_field = current
where_field = path
username_field = username 

Create the table like this:

create table quota (
  username varchar(255) not null,
  path varchar(255) not null,
  current integer,
  primary key (username, path)
); 

Inaccuracy problems

Quota plugin doesn't currently track expunges entirely correctly. If two IMAP clients do an expunge at the same time, the quota is reduced twice as much. The other quota backends have the same problem, but it's not that big of a problem with them because they recalculate the quota once in a while anyway. Dict quota is recalculated only if the quota goes below zero.

So either you'll have to trust your users not to abuse this problem, or you could create a nightly cronjob to delete all rows from the SQL quota table to force a daily recalculation. The recalculation will of course slow down the server.

This problem will be fixed completely in later Dovecot versions.

Dictionary proxy server

To avoid each process making a new SQL connection, you can make all dictionary communications go through a dictionary server process which keeps the connections permanently open.

The dictionary server is referenced with URI proxy:<dictionary server socket path>:<dictionary name>. The socket path may be left empty if you haven't changed base_dir setting in dovecot.conf. Otherwise set it to <base_dir>/dict-server. The dictionary names are configured in dovecot.conf. For example:

dict {
  quotadict = mysql:/etc/dovecot-dict-quota.conf
} 

Example quota plugin configuration for this:

plugin {
  quota = dict:storage=10240:messages=1000 proxy::quotadict
} 

None: Quota/Dict (last edited 2017-04-12 09:00:54 by TimoSirainen)