Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-23-2008, 04:06 PM
|
#1
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Rep:
|
Postfix: How to speed up postmap when using it on a huge database?
I'm downloading this: http://wget-mirrors.uceprotect.net/uce-pfsm-1/access.gz
Uncompress and running postmap access
But it takes very long time to execute.
Any hints on how to improve performance, or is this just what it is; a very slow process?
Edit: The file is 1 481 000 lines long, 207 574 710 bytes. The .db-file is 340 500 480 bytes.
Last edited by robel; 10-23-2008 at 04:09 PM.
|
|
|
10-25-2008, 02:16 AM
|
#2
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Have you considered accessing it online, or are you querying it too often?
|
|
|
10-25-2008, 03:24 AM
|
#3
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Code:
]# time postmap access
real 40m52.828s
user 0m22.361s
sys 0m19.542s
Gosh that's slow. I assume the massive difference between real time and the sum of the others is really inefficient io of postmap? Have you tried running in a ramdisk?
|
|
|
10-25-2008, 04:08 AM
|
#4
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Is there some reason you don't use their rsync method?
|
|
|
10-25-2008, 05:05 PM
|
#5
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
Have you considered accessing it online, or are you querying it too often?
|
Well, on the 25th (yesterday, local time) we got 29747 connections to our mail server. And that's only one. We have four servers all in all.
One server would get over 20 connections a minute. And that would probably lead to 20 queries each minute....?
Yes, rsync is an option. But do they have the .db available (hash database)?
|
|
|
10-25-2008, 05:10 PM
|
#6
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
Code:
]# time postmap access
real 40m52.828s
user 0m22.361s
sys 0m19.542s
Gosh that's slow. I assume the massive difference between real time and the sum of the others is really inefficient io of postmap? Have you tried running in a ramdisk?
|
No I haven't. Good idea. Wonder how much I need.
But doesn't such hash routine use /tmp by default? Or am I mixing this with sort?
The numbers indicate there is a lot of HD activity, so being able to run all in RAM would speed up things. That was sort of what I was hoping for. Never thought if ramdisk though...
|
|
|
10-26-2008, 12:13 AM
|
#7
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Probably does use /tmp, but that's on disk in my case.
I think the rsync version doesn't bother postmapping either. I only had a quick read of their docs though
|
|
|
10-26-2008, 02:29 AM
|
#8
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
Try using the CDB database type, or making it DNS-based instead using rblnsd: http://www.corpit.ru/mjt/rbldnsd.html
|
|
|
10-26-2008, 04:41 AM
|
#9
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
Probably does use /tmp, but that's on disk in my case.
|
According to lsof it doesn't use /tmp which is a good thing as it's on disk in my case. But I need a pretty big ramdisk (around 400 MB). Does a ramdisk swap to disk if there is not enough physical ram available? That would be a disaster in this case.
I'm testing postmapping to a ramdisk right now. Running Slackware-current on top of VMware Workstation (Windows XP). I didn't bother installing Postfix, just compiled the latest version and copied the postmap executable after make. Running this command:
Code:
#time cat access |./postmap -i -c /root /mnt/ramdisk/access
The computer (as seen from Slackware) is a dual Intel Core2 Q6600 at 2.4 GHz, which is actually a quad core by the way. VMware didn't let me use all four cores, but postmap would probably not run any faster on a quad core CPU.
Here is the results of two tests, one on HD, the other one on ramdisk:
First I'll measure the time to read the file:
Code:
# dd if=/root/access of=/dev/null bs=16384
12293+1 records in
12293+1 records out
201410974 bytes (201 MB) copied, 0.0786823 s, 2.6 GB/s
Good enough...  (Yes, the entire file is in cache by now)
Next it's time to run the test on disk:
(my HD-LED is constantly lit)
Code:
# time cat access |./postmap -i -c /root /root/access
real 23m56.618s
user 0m1.410s
sys 1m10.852s
Next, it's time to run the same test with ramdisk:
Code:
# time cat access |./postmap -i -c /root /mnt/ramdisk/access
real 0m41.475s
user 0m3.993s
sys 0m36.288s
Yeah! It's really cooking with gas! (Although the majority of norwegian stoves are electrical and so is my computer...)
It's really an I/O issue when it comes to postmap. Perhaps postmap wasn't intended to work on such scale?
|
|
|
10-26-2008, 05:03 AM
|
#10
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Original Poster
Rep:
|
Huston, we have a problem!
Quote:
Originally Posted by robel
Code:
# time cat access |./postmap -i -c /root /mnt/ramdisk/access
real 0m41.475s
user 0m3.993s
sys 0m36.288s
Yeah! It's really cooking with gas!
|
Code:
# ls -ld /root/access.db /mnt/ramdisk/access.db
-rw-r--r-- 1 root root 374329344 2008-10-26 10:51 /mnt/ramdisk/access.db
-rw-r--r-- 1 root root 339329024 2008-10-26 10:32 /root/access.db
The files are not identical! No errors by postmap, but it's probably not a good idea to use ramdisk. My guess is that the ramdisk was too small (400MB) and that postmap was trying to make the finishing touch and didn't succeed. It should give an error or warning though...
|
|
|
10-26-2008, 05:23 AM
|
#11
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
I'd take Houston out the equation and go rblnsd, which is the recommendation of the guys at uceprotect - see http://www.uceprotect.net/en/index.php?m=6&s=10
|
|
|
10-26-2008, 05:50 AM
|
#12
|
Member
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 77
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
|
That's it! Thanks!
Edit: Thanks to Mr. C.
You came up with the same solution, but I didn't see it. 
Last edited by robel; 10-26-2008 at 04:49 PM.
|
|
|
All times are GMT -5. The time now is 11:29 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|