Amavis temp dir on RAM disk

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
User avatar
pup_seba
Outstanding Member
Outstanding Member
Posts: 687
Joined: Sat Sep 13, 2014 2:43 am
Location: Tarragona - Spain
Contact:

Amavis temp dir on RAM disk

Post by pup_seba »

Hi,

For the first time, I'm trying to configure amavis temp direcotry on RAM disk but I have doubts on how to properly size the disk.
1) https://wiki.zimbra.com/wiki/Tmpfs_for_amavisd-new
Outdated and I also can't understand the forumla there. I get the value of "n" and I get the value of "zimbraMtaMaxmessageSize"...but I can't understand what (1 + max(expansionfactor) is or how to get that info.

2) https://wiki.zimbra.com/wiki/Anti-spam_ ... a_RAM_Disk
Current guide but it only references "Ralf Hildebrandt's book on Postfix" as per sizing, but the wiki itself explains nothing about how to do it. That is not a book that I have (I have Kyle D. Dent O'Reilly books for postfix but no mention of this configuration).

So, before rushing to buy a book only to learn how to size this or just overkilling, I wonder if any of you have tips or knowloedge on how to size this ram disk.

Thanks,
User avatar
ccelis5215
Outstanding Member
Outstanding Member
Posts: 632
Joined: Sat Sep 13, 2014 2:04 am
Location: Caracas - Venezuela
ZCS/ZD Version: 8.8.15.GA.3869.UBUNTU18.64 P12

Re: Amavis temp dir on RAM disk

Post by ccelis5215 »

pup_seba wrote:Hi,

For the first time, I'm trying to configure amavis temp direcotry on RAM disk but I have doubts on how to properly size the disk.
1) https://wiki.zimbra.com/wiki/Tmpfs_for_amavisd-new
Outdated and I also can't understand the forumla there. I get the value of "n" and I get the value of "zimbraMtaMaxmessageSize"...but I can't understand what (1 + max(expansionfactor) is or how to get that info.

2) https://wiki.zimbra.com/wiki/Anti-spam_ ... a_RAM_Disk
Current guide but it only references "Ralf Hildebrandt's book on Postfix" as per sizing, but the wiki itself explains nothing about how to do it. That is not a book that I have (I have Kyle D. Dent O'Reilly books for postfix but no mention of this configuration).

So, before rushing to buy a book only to learn how to size this or just overkilling, I wonder if any of you have tips or knowloedge on how to size this ram disk.

Thanks,


Hi pup_seba,

Read viewtopic.php?t=18006&start=10 there are details you are asking for.

Also https://www.missioncriticalemail.com/20 ... uidelines/ by L. Mark Stone too.

ccelis
phoenix
Ambassador
Ambassador
Posts: 27272
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: Amavis temp dir on RAM disk

Post by phoenix »

Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
User avatar
pup_seba
Outstanding Member
Outstanding Member
Posts: 687
Joined: Sat Sep 13, 2014 2:43 am
Location: Tarragona - Spain
Contact:

Re: Amavis temp dir on RAM disk

Post by pup_seba »

Thanks for the links! :) Although now I'm able to get results, I still fail to understand that formula :/

In Ralf example, the forumla:
n * (1 + max(expansionfactor)) * $message_size_limit

Would translate to something like:
5 * (1 + max(expansionfactor)) * 10MB

1. First thing I see here are units. In the formula no units are expressed so I must assume based on examples that MB is the unit for $message_size_limit.
2. I'm still riddle by "max(expansionfactor)".
3. Parenthesis here are use as in a proper math forumla so this would translate to something like: 1 + max * expansionfactor which also makes no much sense to me.
4. Ralf also mentions a "1:2" ratio...which has no clear mapping to this formula.
5. The total gives him 130MB but then he maps a disk of 150MB...is that overhead necessay? And if so, should it be part of the formula too?

On top of all of this, the end result just makes no sense to this formula...unless my math are plain wrong (which is likely the case). He speaks about 5*10MB (n * message_size_limit) and 5*8MB (n * message_size_limit binary size), then he comes up with a ratio that i assume is not fixed (otherwise it should be part of the formula) of 1:2 to multiply the result of 5*8MB...which later on he just adds to the initial 5*10MB. idk...as I said, I can come up with an alternate formula that will deliver the same result as in his example, but lord it has nothing to do with the initial presented formula. New formula based on his example would be like:
[(n * message_size_limit in MB) + ( n * message_size_limit in MB * binary_ratio * unpack_ratio)] + extra_room =
-> "n" comes from the value set for max_servers in /opt/zimbra/conf/amavisd.conf
-> "message_size_limit" is defined in the zimbra global configuration zimbraMtaMaxMessageSize and corresponds to the raw size of the mail
-> binary_ratio corresponds to the binary size of the mail and it can vary. This formula will consier a value of 4/5 of the mail size (mail_size * 0.8)
-> unpack_ratio seems to corresponds to (message_size_limit in MB * binary_ratio) * 2 but idk if this number is variable or is a fixed value
-> As we have 2 fixed ratios, I will just write it as a new_ratio of value 1.6 (0.8 * 2)
-> extra_room corresponds to the extra size provided in the Ralf example during fstab configuration, which is ~ a +20% of the total
Making use of the new formula, examples would look like this...which at least for me now make some sense:
[(n * message_size_limit in MB) + (n * message_size_limit in MB * new_ratio )] * 1.2 = value in MB that should be placed in fstab for the RAM disk
[(5 * 10MB) + (5 * 10MB * 1.6 )] * 1.2 =
( 50MB + 80MB ) * 1.2 =
130MB * 1.2 = 156MB
This result matches the example provided in https://www.arschkrebs.de/postfix/amavisd_tmpfs.shtml

If we change the values to the default values, as the example used in here (which also uses Ralf forumla), n would take a 10 instance value:
[(n * message_size_limit in MB) + (n * message_size_limit in MB * 0.8 * 2)] * 1.2 =
[( 10 * 10MB ) + (10 * 10MB * 1.6)] * 1.2 =
[( 100MB ) + ( 160MB )] * 1.2 =
260MB * 1.2 = 312MB
This will not match what is provided in the example, because they do not provide "overhead" in the fstab, in fact the example there looks like a copy/past from Ralf where the "150MB" value used in the Ralf webpage was not adapted to the 10MB value used in zimbra wiki example.

So for an installation with a size limit policy of 20MB email which should be configured with a value around 27MB, and the default number of max_servers instances configured (10). We would have something like this:
[(10 * 27MB) + (10 * 27MB * 1.6)] * 1.2 =
(270MB + 432MB) * 1.2 = 518MB to configure in the fstab

Anyways, just trying to make sense of all. Gosh...now I kind of want to buy this guy book :D
User avatar
ccelis5215
Outstanding Member
Outstanding Member
Posts: 632
Joined: Sat Sep 13, 2014 2:04 am
Location: Caracas - Venezuela
ZCS/ZD Version: 8.8.15.GA.3869.UBUNTU18.64 P12

Re: Amavis temp dir on RAM disk

Post by ccelis5215 »

I have used 1024 Mb in my servers without problem.

Just don't over analyze and you'll be fine.

ccelis
Post Reply