Tải bản đầy đủ - 0 (trang)
Parameters in /etc/imapd.conf that Influence Performance

Parameters in /etc/imapd.conf that Influence Performance

Tải bản đầy đủ - 0trang

14.10



Performance Tuning



ƠĨỜ Đ ĨÙØ

By default, inactive POP3 connections are kept open for 10 minutes.

You can enter a shorter time (in minutes) to relieve the demand on

server resources.



Ơ Ừ Ø ĨỊ¹Ị Ñ

You can distribute new mailboxes to additional mailbox partitions in

order to relieve the load on your RAID system, or if you are running

out of memory. For more information, see section 14.5 on page 239.

You can improve performance slightly by changing the format of the index

databases.



Ö



Ð Ý

Databases in this format react to queries fairly quickly and support

binary contents. They are often slightly unstable, which is usually

due to locking errors when accessed a lot.







ì



é íạềểìíề



This option is identical to

ệ é í, but data is held in the cache

before being written. This increases the speed of write accesses. Unfortunately, it also reduces data security: If the cache is deleted for

some reason (a power outage, for example), the data is lost.



ƠÐ ×Ø

This format was developed by the Cyrus programmers. If offers good

write and read access, supports binary contents, and is known to be

relatively stable. If locking problems occur with Berkeley databases,

× ƠÐ ×Ø is the next best option.



Ð Ø

Databases in this format are relatively easy to handle, as their contents are text based. They are also fairly stable, but the speed for

write accesses is comparatively poor.

If you change the format of a database backend, it is not enough simply to

enter it in the » Ø » Đ Ơ º ĨỊ file. You also have to convert the database

into the required format with the ÚØ ÝỨ× tool described on page 267.

Please also note that not every format is suitable for every Cyrus database:



×



Ị×Ø Ø

This is where you can specify the format of the index database for the

“read” status. The developers of Cyrus recommend × ƠÐ ×Ø, but

you can also use Ö Ð Ý and Ð Ø.



ỊỊĨØ Ø ĨỊ

This option specifies the format of the annotation database. This



259



www.it-ebooks.info



14 Advanced Cyrus Configuration



contains server metadata, such as system information or the email

address of the server administrator. You can use Ư Ð Ý and × Ơ

Ð ×Ø.



ÙƠÐ



Ø

In this database, Cyrus stores information that it requires to suppress

duplicate emails. This function is activated by default, but you can

deactivate it in the ằ ỉ ằ íệì ểề file in the ẻ ỈÌËß section

(see section 12.1.3 on page 202).

You can use

Ư Ð í, ệ é íạềểìíề , and ì ễé ìỉ. If you

use

ệ é íạềểìíề , Cyrus keeps changes in the cache and only

writes them into the database when the server is less busy. This value

is recommended here.



Ờ×

This option specifies the format of a database that is used to optimize the working memory management. You can use

Ư Ð Ý and

× ƠÐ ×Ø.



ÕÙĨØ

The quota database contains the currently valid mailbox quotas. You

Ö Ð Ý, × ƠÐ ×Ø, and ÕÙĨØ Ð

Ý. The latter

can use Ð Ø,

option was developed specifically for managing quotas in Cyrus and

is therefore recommended.



×Ù × Ư Ờ ĨỊ

The subscription database contains information on the mailboxes

that are currently in use. You can use Ð Ø, Ư Ð Ý, and × ƠÐ ×Ø.



ØÐ×

The TLS cache memorizes TLS connection information. You can use

the database formats

ệ é í, ệ é íạềểìíề , and ì ễé ×Ø.

Ư РݹỊĨ×ÝỊ , as caching information does not

We recommend

have to be written immediately, and the I/O load on the disk is reduced.

You can also improve performance by using faster hard disks and choosing

an appropriate filesystem (see page 53). It is advisable to use a filesystem

that performs well when handling multiple small files. ReiserFS gets the

best results in most benchmark tests. However, we have found that ReiserFS

is not always stable and requires a lot of work and patience when problems

occur. Reiser4 makes an even better impression where speed is concerned,

but due to its beta status, it should be used carefully. When making your

decision, you should also check the repair tools available for your choice of

filesystem and take your skills with these tools into account.



260



www.it-ebooks.info



Chapter



15



Internal Structure and Modules

You do not necessarily need to know which modules a Cyrus IMAP server is

composed of and which internal auxiliary programs it uses, but this background information is important for troubleshooting. Cyrus is built according to the classic Unix concept of “one service—one function,” which

means that it has a modular structure (as shown in Figure 15.1) and is controlled by a master process, just like Postfix. The individual components of

Cyrus are listed in the »Ù×Ư»Ð » ÝỨ×» Ị» directory.

Nearly all the programs listed there are started exclusively by the Cyrus

master process and not manually. If you have to call any of them manually,

for example, when repairing a faulty mail server, you have to make each

call as the user ÝỨ×.

The names can vary in different distributions; some Cyrus packages provided by distributions do not contain some of these tools, while others

contain additional special tools.



261



www.it-ebooks.info



15 Internal Structure and Modules



Figure 15.1:

The most important

Cyrus processes and

their functions



Port 25



Port 110



Port 143



Port 2000



pop3d



imapd



timsieved

Cyrus−SASL

(libsasl)



MTA

(Postfix)



lmtpd



master



relay_domains

transport_maps



mailboxes



15.1



saslauthd

auxprop

authdaemond



User data

(File, SQL, LDAP, PAM)



The Cyrus Daemons



The following programs are daemons that provide specific services in the

background. They are all started by the Đ ×Ø Ư process. This master process is at the heart of Cyrus. It and all its dependent services run under

the ÝỨ× Unix account, which provides additional security for the system.

Should an attacker hack into the IMAP server, he or she will only have the

permissions of ÝỨ×.



Ð

This service can be used to inform the mail client when new messages

have been received. Usually, mail clients check mailboxes regularly,

without knowing whether new emails have been received. The idle

daemon evaluates the signals from the LMTP daemon and forwards

this information to the mail client.



Đ Ơ

This daemon provides the IMAP function and opens the IMAP ports.



ÐĐØƠ

This service provides the LMTP socket and manages it according to

the configuration in » Ø » ÝỨ׺ ĨỊ . It is the interface between

Cyrus and the delivering MTA.



ÐĐØƠƠƯĨÜÝ

The LMTP proxy service is used in cluster setups and transfers the

emails received from the MTA to the backend server.



ĐÙƠ



Ø

This is the Cyrus Murder server service. It is required by Cyrus clusters, where it synchronizes the information with that from the Cyrus

backend servers (see page 281).



262



www.it-ebooks.info



15.2 Tools for Analysis, Maintenance, and Repairs



ỊỊØƠ

This daemon downloads messages via the Net News Transfer Protocol.



ỊĨØ



Ý

The Cyrus notification service (see section 14.7 on page 252) processes the notification requests from the master process when an

email is delivered via LMTP. Depending on the configuration, it either creates a log entry or sends a message (e. g., via email) when a

new email is received.



ƠĨƠ¿

This service provides the Cyrus POP3 function.



ƠĨƠ¿ƠƯĨÜÝ

The POP3 proxy server is only used in cluster setups and transfers the

POP3 requests from mail clients from the frontend to the backend

server.



×ĐĐ Ơ

Cyrus uses the Sendmail Socket Map Daemon to check whether a

mailbox exists and whether it is within its quota. If the mailbox does

not exist, or if it has reached its quota, ×ĐĐ Ơ provides this information to the master process.



Ø Đ×



Ú

This is the Sieve email filter service (see section 14.6.1 on page 240).



15.2 Tools for Analysis, Maintenance, and Repairs

Cyrus uses some of the following auxiliary programs internally; in many

distributions, they are already integrated in » Ø » ÝỨ׺ ĨỊ . They can

also be called manually for analyses or repairs.



15.2.1

Ư



Statistics and Analysis



ØƯĨỊ

This tool provides statistical information on all mailboxes, or on individual mailboxes if specified:

cyrus@linux:~/bin$ ./arbitron

Loading Mailboxes...Done

Loading Users..........................

example/net!user/quotatest 0 0

user.achim 0 0

example/com!user/paul/Trash 0 0



263



www.it-ebooks.info



15 Internal Structure and Modules



example/com!user/paul.meier 0 0

example/com!user/paul/memo 0 0

example/com!user/paul 0 0

example/com!user/paul.meier/schrott 0 0



For each mailbox, this tool creates one line with the following information: the mailbox name and the number of accounts that have

read this mailbox within the past 30 days, followed by the number of

subscribers to this mailbox directory.

The ¹ switch restricts the time period for which the statistical information is supplied (ạ ắẳ, for example, will limit the statistical time

period to the past 20 days). The ¹Ơ switch allows statistical evaluation

for more than one month (ạễ ẵẳ provides statistical information for

the last ten months, for example).



ÝỨ×

This tool checks the consistency of the Cyrus databases by synchronizing them with the email directories:

cyrus@linux:~/bin$ ./chk_cyrus

Examining partition: ALL PARTITIONS

checking: example.com!user.paul (/var/spool/imap/domain/example.com

/user/paul)

-> 5 records

checking: example.com!user.paul.Trash (/var/spool/imap/domain/examp

le.com/user/paul/Trash)

-> 0 records

checking: example.com!user.paul.memo (/var/spool/imap/domain/exampl

e.com/user/paul/memo)

-> 3 records

checking: example.com!user.paul^meier (/var/spool/imap/domain/examp

le.com/user/paul^meier)

-> 2 records

checking: example.com!user.paul^meier.schrott (/var/spool/imap/doma

in/example.com/user/paul^meier/schrott)

-> 2 records

checking: example.com!user.quotatest (/var/spool/imap/domain/exampl

e.com/user/quotatest)

-> 1 records

checking: sommer.top!user.geeko (/var/spool/imap/domain/sommer.top/

user/geeko)

-> 0 records

checking: user.paul (/var/spool/imap/user/paul)

-> 0 records

checking: user^horst (/var/spool/mail1/user^horst)

-> 0 records



The list shows all existing mailbox directories, together with their

path in the filesystem and the number of emails found. If this information does not match the information in the Cyrus databases,



264



www.it-ebooks.info



15.2 Tools for Analysis, Maintenance, and Repairs



the tool returns an inconsistency warning message. You should then

use Ư ĨỊ×ØỨ Ø to repair the inconsistent mailbox.



Đ



Ü Đ Ị

This tool examines the mailbox, index, and header files and transfers

this information to another process, to the screen, or to a file. It is

useful if you need a detailed overview of the mailboxes.

If you call this command without a switch, it will provide information

on all mailboxes. You can also specify an individual mailbox:

cyrus@linux:~/bin$ ./mbexamine user/paul/memo@example.com

Examining user/paul/memo@example.com...

Mailbox Header Info:

Path to mailbox: /var/spool/imap/domain/example.com/user/paul/me

mo

Mailbox ACL: paul@example.com lrswipcda

quotatest@example.

org

lrs

Unique ID: 1a9e415d4564f279

User Flags: $NotJunk $Junk JunkRecorded

Index Header Info:

Generation Number: 58

Format: NORMAL

Minor Version: 6

Header Size: 76 bytes Record Size: 60 bytes

Number of Messages: 1 Mailbox Size: 1499 bytes

Last Append Date: (1186641337) Thu Aug 9 08:35:37 2007

UIDValidity: 1164243577 Last UID: 12

Deleted: 0 Answered: 0 Flagged: 0

POP3 New UIDL: 1

Last POP3 Login: (0) Thu Jan 1 01:00:00 1970

Message Info:

000001> UID:00000012

INT_DATE:1184694344 SENTDATE:1184666400 SIZE

:1499

> HDRSIZE:1497

LASTUPD :1186641337 SYSFLAGS:00000000

LINE

S:1

CACHEVER:2

> USERFLAGS: 00000000 00000000 00000000 00000001

Envel>{278}("Tue, 17 Jul 2007 19:46:30 +0200" "Testtt" (("Peer Har

tleben" NIL "mail" "peer2peer.it")) (("Peer Hartleben" NIL "mail" "

peer2peer.it")) (("Peer Hartleben" NIL "mail" "peer2peer.it")) ((NI

L NIL "paul" "example.com")) NIL NIL NIL "<200707171946.30885.mail@

peer2peer.it>")

BdyStr>{81}("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 2

1 NIL ("INLINE" NIL) NIL)

Body>{58}("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 2

1)

CacHdr>{188}User-Agent: KMail/1.9.6

Content-Type: text/plain;

charset="us-ascii"

Content-Transfer-Encoding: 7bit



265



www.it-ebooks.info



15 Internal Structure and Modules



Content-Disposition: inline

Message-Id: <200707171946.30885.mail@peer2peer.it>

From>{33}peerhartleben

To>{25}

Cc>{0}

Bcc>{0}

Subjct>{8}"testtt"



This result shows the header information from the Đ ĐĨ subdirectory

of Ơ ÙÐ Ü ĐƠÐ º ĨĐ’s mailbox; among other things, the header information shows the paths, the permissions, and the number, size,

and headers of the messages the mailbox contains. In the example,

the subdirectory contains a message with Ø ×ØØØ in the subject line.



Đ Ơ Ø

This tool returns the path to the storage location in the system of the

specified mailbox’s contents (Ơ ÙÐ Ü ĐƠÐ º ĨĐ’s mailbox, in this

example):

cyrus@linux:~/bin$ ./mbpath user/paul@example.com

/var/spool/imap/domain/example.com/user/paul



15.2.2



Maintenance and Repair



The tools described here are useful aids for maintenance work on Cyrus.

Some applications can be run automatically, for example, as a cron job.



ØÐ



ÝỨ×

This tool maintains and repairs all Cyrus databases. If you call the

program with the ¹Ư switch, it tidies up the database and attempts to

repair defects. This tool is executed automatically every 30 minutes

and whenever Cyrus is started. You can find it in the » Ø » ÝỨ׺

ĨỊ file in the sections ËÌ ÊÌ and ẻ ặèậ.



ỉé



é ệ

This tool carries out checks and maintenance on the deliver database

Ð Ú Öº . It is usually operated by Cyrus, but you can also use

it manually to read out the deliver database. This is done by callÐ Ú Ư ¹ , which lists the emails that were most recently

ing ØÐ

delivered.



ØÐ Đ ĨÜÐ ×Ø



This tool carries out internal checks and maintenance on the Đ Ð Ĩ

Ü ×º database. This tool can also return the contents of that mailbox if the ¹ switch is activated. The database contains a list of all

mailboxes and the permissions that have been assigned:



266



www.it-ebooks.info



15.2 Tools for Analysis, Maintenance, and Repairs



cyrus@linux:~/bin$ ./ctl_mboxlist -d

example.com!user.paul

default

example.com!user.paul.Drafts

default

example.com!user.paul.Sent

default

example.com!user.paul.Test

default

example.com!user.paul.Trash

default



ÚØ



paul@example.com

paul@example.com

paul@example.com

paul@example.com

paul@example.com



lrswipcda

lrswipcda

lrswipcda

lrswipcda

lrswipcda



ÝỨ×

This tool converts Cyrus databases into different database formats.

When called without a switch, it shows the database formats that can

currently be converted. The conversion is done by issuing a command of the following form:

cvt_cyrusdb name_of_old_db old_db_format name_of_new_db \

new_db_format



The following example converts ỊỊĨØ Ø ĨỊ׺ from the ×

format to the Ð Ø format (see section 14.10.1 on page 259):



ƠÐ ×Ø



cyrus@linux:~/bin$ ./cvt_cyrusdb /var/lib/imap/annotations.db \

skiplist /tmp/TEST-db flat

Converting from /var/lib/imap/annotations.db (skiplist) to /tmp/TE

ST-db (flat)

Warning: apparently empty database converted.



Make sure that you always enter the absolute paths to the databases,

as the tool will otherwise terminate with an error message.



ÝƯ ÙĐƠ

This tool returns the contents of a mailbox on the standard output,

where the emails are shown one after another. You have to specify

the mailbox or subdirectory as the argument:

cyrus@linux:~/bin$ ./cyrdump user/paul@example.com > paul_dump



creates a dump for Ô ÙÐ

named Ơ ÙÐ ÙĐƠ.



Ü ĐƠÐ º ĨĐ’s mailbox and saves it in a file



ÕÙÓØ

This tool manages and repairs the mailbox quota (see section 14.9.2

on page 257).



Ư



ĨỊ×ØỨ Ø

This tool initializes and repairs the Cyrus database directory (see section 14.9.1 on page 255).



×ÕÙ ØØ Ö

This program creates a squat fulltext index for every mailbox. It lists

all existing emails in this index so that they are easier to find for the



267



www.it-ebooks.info



15 Internal Structure and Modules



mail client. Please note that the index can only account for existing

emails. When new emails are received, you have to run ×ÕÙ ØØ Ư

again. For this reason, it makes sense to activate this program as a

regular event in the » Ø » ÝỨ׺ ĨỊ file, for example, by adding

the following line in the ẻ ặèậ section:

squatter

riod=120



cmd="/usr/bin/nice -n 19



/usr/lib/cyrus/bin/squatter" pe



ìế ỉỉ Ö now runs every two hours with a Ò

value of 19. After

activating ×ÕÙ ØØ Ư, you should observe your system load. If there

are a large number of large mailboxes, creating the index can take

some time and slow down the system. For this reason, you should

value, so as not to put too

only start this service with a high Ò

much unnecessary strain on your server.



15.2.3



Internal Tools



There are also service programs that only Cyrus can use and that are useless

for administrators.



ĨĐƠ Ð



×



Ú



This tool translates Sieve scripts into byte code so they can run in

the Sieve daemon. It is almost identical to × Ú and is used when

Sieve scripts are created automatically. There is more information on

this subject in section 14.6.5 on page 251.



ÝƯ



ÜƠ Ö

This tool marks messages as obsolete, thereby flagging them for deletion. It has been entered as a regular command in the ằ ỉ ằ íệì

ểề file in the ẻ ặèậ section (see section 12.1.3 on page 202).



Ð Ú Ö

This tool sorts delivered emails into the correct inboxes. It is usually

used only by the master process, but other MTAs can use it to deliver

emails (see section 14.8 on page 254).



Ø



Ị Û×

This tool receives news from news servers approved as peering partners and transfers these news messages to the Cyrus master process.



Ù

This tool delivers master process information on the status of mailboxes and the emails they contain.



ỚƯ

This tool deletes emails from inboxes according to their age and expiration date (see section 12.1.3 on page 202).



268



www.it-ebooks.info



15.3 Other In-House Tools



×



Ú



Like ĨĐƠ Ð × Ú , this tool translates Sieve scripts into binary

code so they can be executed by the Sieve daemon. It is executed

by default when Sieve scripts are uploaded.



ØÐ× ƠỨỊ



This tool deletes expired TLS sessions from the ØÐ× × ×× ĨỊ׺

database (see section 12.1.3 on page 202).



15.3 Other In-House Tools

Some distributions contain additional Cyrus tools in the documentation

directory in »Ù×Ư»× Ư » Ĩ ằễ

ìằ íệìạ ẹ ễằỉểểéìằ. This is a

collection of mostly undocumented scripts that can be used for additional

tasks.



Ư



ØƯĨỊ×ĨỪºƠÐ



This tool sorts the output of the Ư ØƯĨỊ statistics tool (see section 15.2.1 on page 263) according to the number of users that have

selected and subscribed to a mailbox.



ĨỊ



¾



Ư



This tool is used to compile and patch the Cyrus source code; it is

called automatically during compilation.



ĨỊ



¾Đ Ị

This tool is also used to compile the source code and called automatically during compilation.



ểề ệỉạì



ễé



This tool is required when upgrading Cyrus versions up to and including 2.1.12. It adapts Sieve scripts to the namespace Cyrus uses

for virtual domains.



Ĩ



×

This tool is required for upgrading Cyrus versions up to and including

1.6.1. This tool creates a hash value for faster mailbox indexing.



Đ ×××



Ú



This upgrade tool for Cyrus versions up to and including 2.2.0 adapts

existing Sieve scripts to the modified byte code format.



Đ



Đ Ơ

This tool creates the directory structure that Cyrus requires, which

consists of mailboxes and an index/administration section; it is usually only required when Cyrus is installed manually from the source



269



www.it-ebooks.info



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Parameters in /etc/imapd.conf that Influence Performance

Tải bản đầy đủ ngay(0 tr)

×