Postfix Map Types
Maps are the files and databases created from files that are used to look up information. The basic structure of maps are two columns, a left-hand side (key) and a right-hand side (value).
key value
Postfix uses a number of map types. These maps are critical to Postfix looking up information quickly.
To view the supported map types on your system use this command:
# postconf -m
btree
cidr
environ
hash
nis
proxy
regexp
sdbm
static
tcp
unix
Run the postconf -m command to review the supported map types.
Indexed Maps (hash, btree,dbm)
These maps are actually binary files built from text files that you can edit. The alias file is a good example. In the example you can see that the key is “root:” and the value is “someuser@somewhere.com”.
root: someuser@somewhere.com
This file allows you to edit it and then when you are done you can run the newaliases command to create the binary file aliases.db which is the file read by Postfix. Because these maps are indexed they can be read quickly by Postfix. In addition, these maps are placed in memory when the system starts, a further enhancement to speed.
Linear Maps (PCRE, regexp, CIDR and Flat Files)
These are typical text files. The purpose of these files is to allow Postfix to read them from top to bottom and when a match is found to take some action. This process is much like iptables in that the first match is what counts so order in the file is extremely important. One problem with these maps is that as they get larger it takes more time for Postfix to read them.
Database Maps (MySQL, PostgreSQL, LDAP)
When you use a database Postfix looks for a match or no match when it uses a query. The advantage of a database is that if a change occurs in the database it does not have to be restarted like an indexed map. The disadvantage is that a database will have to be able to handle a large number of queries as a single connection requires 3 queries. Since the default simultaneous processes is 100 (set with the default_process_limit) this could easily mean 300 simultaneous queries. These database queries have a high latency as the request is made and then Postfix must wait for the response. With index maps the data is already loaded in memory.
Posted by mike 

You must be logged in to post a comment.