Rather than making individual connections to MySQL for extracting information from the 'indimail' table, IndiMail programs use the service of the inlookup(8) server. Programs use an API function inquery() to request service. InLookup is a connection pooling server to serve requests for inquery() function. It is implemented over two fifos. One fixed fifo for reading the query and reading the path of a randomly generated fifo. The randomly generated fifo is used for writing the result of the query back. inlookup(8) creates a read FIFO determined by the environment variable INFIFO. If INFIFO is not defined, the default FIFO used is /var/indimail/inquery/infifo. inlookup(8) then goes into an infinite loop reading this FIFO. If INFIFO is not an absolute path, inlookup(8) uses environment variable FIFODIR to look for fifo named by INFIFO variable. Inlookup(8) can be configured by setting environment variables in /service/inlookup.info/variables
-
inlookup helps in optimizing connection to MySQL(1), by keeping the connections persistent.
-
It also maintains the query result in a double link list.
-
It uses binary tree algorithm to search the cache before actually sending the query to the database.
-
IndiMail clients send requests for MySQL(1) queries to inlookup through the function inquery() using a fifo.
-
The inquery() API uses the InLookup service only if the environment variable QUERY_CACHE is set. If this environment variable is not set, the inquery() function makes a direct connecton to MySQL.
-
Clients which are currently using inquery are qmail-smtpd(1), proxyimap(8), proxypop3(8), vchkpass(8) and authindi(8).
-
inlookup(8) service is one of the reasons why IndiMail is
able to serve million+ users using commodity hardware.
% sudo inquerytest -q 3 -i ""
user@example.com
No comments:
Post a Comment