HTTP Anti-Virus Proxy

Official HAVP Support Forum
Registration disabled, I'm tired of spambots. E-mail havp@hege.li if you have questions.
HAVP project is pretty much frozen/abandoned at this time anyway.
It is currently 22 Jun 2014 09:52

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: 09 Mar 2008 12:18 
Offline

Joined: 16 Sep 2006 07:25
Posts: 20
Is the performance difference between using a loopback file and using a dedicated ext3 partition to store the temp files, significant?

Os


Top
 Profile  
 
 Post subject:
PostPosted: 09 Mar 2008 14:57 
Offline
HAVP Developer

Joined: 27 Feb 2006 18:12
Posts: 687
Location: Finland
I don't think so. If you have enough memory, everything is cached by the OS anyway. Measure and tell us. ;)


Top
 Profile  
 
PostPosted: 14 Mar 2008 21:30 
Offline

Joined: 16 Sep 2006 07:25
Posts: 20
OK, I have not been able to detect any real world difference so far, but maybe I'm just not able to generate enough requests.

Any ideas as to how I can generate a lot of requets from a single client?
Any suggestions for a suitable benchmarking/measurement tool?

Os


Top
 Profile  
 
 Post subject:
PostPosted: 14 Mar 2008 22:00 
Offline
HAVP Developer

Joined: 27 Feb 2006 18:12
Posts: 687
Location: Finland
http://www.acme.com/software/http_load/
http://httpd.apache.org/docs/2.2/programs/ab.html

etc..


Top
 Profile  
 
 Post subject:
PostPosted: 09 Apr 2008 02:21 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
I've had great results w/the following fstab:

Code:
/dev/VolGroup00/LogVol00 /                       ext3   defaults,mand,noatime,auto,rw,dev,exec,suid,nouser,data=writeback 0 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
#/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
tmpfs                   /tmp                    tmpfs   defaults,noatime        0 0
tmpfs                   /var/spool/squid        tmpfs   defaults,noatime        0 0


Squid and ClamAV both use tmpfs. HAVP uses ext3 on the root part. with writeback enabled.


Top
 Profile  
 
PostPosted: 12 Apr 2008 19:25 
Offline

Joined: 16 Sep 2006 07:25
Posts: 20
DrKewp,

How big are your tmpfs storage areas for Squid and Clamav?

Regards

Os


Top
 Profile  
 
PostPosted: 12 Apr 2008 20:12 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
The box has 8 gigs RAM, no swap.

All tmpfs partitions are the default, which is one-half RAM. So 4 gigs each. The only one that will ever fill up (I hope!) is the squid cache.

Squid is configured to use 2 gigs ram and 4 gigs 'disk' (tmpfs) cache.


Top
 Profile  
 
PostPosted: 13 Apr 2008 12:42 
Offline

Joined: 16 Sep 2006 07:25
Posts: 20
Wouldn't your squid cache benefit from being persistent over reboots? I'm guessing that after a reboot, using tmpfs would mean that it takes a significant amount of time to re-populate and optimise.

Would I be correct in assuming that the reason you are not using tmpfs for the havp temp directory is because it doesn't support mandatory locking?

I wonder what other directories would benefit from using tmpfs?
GNOME, Clamav & MySQL use /tmp by default.
I will certainly try using tmpfs for P3Scan temp dirs /var/spool/p3scan/children & /var/spool/p3scan/notify.
Any other ideas for temp dirs to try tmpfs with? Apache2?, lighttpd?, dhcp?, bind?, samba? ......

Regards

Os


Top
 Profile  
 
PostPosted: 14 Apr 2008 03:46 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
Osiris X wrote:
Wouldn't your squid cache benefit from being persistent over reboots? I'm guessing that after a reboot, using tmpfs would mean that it takes a significant amount of time to re-populate and optimise.

Not really.

It pains me to say this as someone whom used to do web caching as a full-time job, but in the web 2.0 world caches are almost useless. We see less than a 10% bandwidth saving from our current implementation. Too much streaming and dynamic content these days.

Caches still help for a myriad of reasons, but its usually during the flash crowd kind of scenarios. So having a persistent storage doesn't buy you much. Plus I don't plan on bouncing the box more than once a week, tops.
Quote:
Would I be correct in assuming that the reason you are not using tmpfs for the havp temp directory is because it doesn't support mandatory locking?

Tmpfs + mandatory locking is technically supported, it just doesn't work consistently with havp for some reason. I looked into it and its some sort of exotic race condition I really don't feel like debugging. A ramdisk works fine if you want that, but it has to be statically sized at boot. You can also use a loopback file and keep it in tmpfs, which works as well. But I worry about the overhead.

I have squid configured to whitelist all the heavy the content, so only a small % is getting scanned. Given the aggressive buffering the linux kernel does plus my filesystem tweaks I don't expect the disk is being touched much, if at all. So far the disk seems mostly idle with my current configuration, so I'm happy.
Quote:
I wonder what other directories would benefit from using tmpfs?
GNOME, Clamav & MySQL use /tmp by default.
I will certainly try using tmpfs for P3Scan temp dirs /var/spool/p3scan/children & /var/spool/p3scan/notify.
Any other ideas for temp dirs to try tmpfs with? Apache2?, lighttpd?, dhcp?, bind?, samba? ......

I build all my boxes the same way, tons of ram, no swap and tmpfs for /tmp and /var/tmp (+/var/spool/squid on the web caches). I have scheduled reboots to keep 'em clean, amongst other things.

Any scratch work is much faster via tmpfs, if you have the free memory to pull it off. Portage builds are much faster, for example.


Top
 Profile  
 
PostPosted: 14 Apr 2008 10:17 
Offline
HAVP Developer

Joined: 27 Feb 2006 18:12
Posts: 687
Location: Finland
DrKewp wrote:
Tmpfs + mandatory locking is technically supported, it just doesn't work consistently with havp for some reason. I looked into it and its some sort of exotic race condition I really don't feel like debugging.


Linux that is. On Solaris tmpfs works flawlessly.

If you have info, then please share it.


Top
 Profile  
 
PostPosted: 15 Apr 2008 00:29 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
hege wrote:
Linux that is. On Solaris tmpfs works flawlessly.

If you have info, then please share it.


Based on my testing, attempting to lock a file on a tmpfs partion on linux will sometimes return a 'Resource not available' error. It's not consistent and seems to happen randomly, regardless of load. The files will ultimately be created, but the havp log file fills up with errors in the process. I was going to experiment with putting in a delay during the file creation, but since that negates the performance benefit of tmpfs, I decided to just punt it.

My research indicated the problem may actually be with the locking process itself, see:
http://www.mjmwired.net/kernel/Document ... ocking.txt

The documentation indicates that the Linux implementation of mandatory locking leaves much to be desired...

Code:
8   0. Why you should avoid mandatory locking
9   -----------------------------------------
10   
11   The Linux implementation is prey to a number of difficult-to-fix race
12   conditions which in practice make it not dependable:
13   
14      - The write system call checks for a mandatory lock only once
15        at its start.  It is therefore possible for a lock request to
16        be granted after this check but before the data is modified.
17        A process may then see file data change even while a mandatory
18        lock was held.
19      - Similarly, an exclusive lock may be granted on a file after
20        the kernel has decided to proceed with a read, but before the
21        read has actually completed, and the reading process may see
22        the file data in a state which should not have been visible
23        to it.
24      - Similar races make the claimed mutual exclusion between lock
25        and mmap similarly unreliable.


Top
 Profile  
 
PostPosted: 15 Apr 2008 08:22 
Offline
HAVP Developer

Joined: 27 Feb 2006 18:12
Posts: 687
Location: Finland
Yeah I guess I will just update documentation to clearly state that Linux+tmpfs is broken. Hopefully someone has time or motivation to debug it someday.


Top
 Profile  
 
PostPosted: 18 Apr 2008 02:22 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
hege wrote:
Yeah I guess I will just update documentation to clearly state that Linux+tmpfs is broken. Hopefully someone has time or motivation to debug it someday.


I wouldn't say Linux+tmpfs is broken. It's really the linux implementation of mandatory locks is broken, which manifests itself overtly when used on a tmpfs partition.

I use tmpfs for everything on linux and have had no other problems with it. Works like a charm.


Top
 Profile  
 
PostPosted: 18 Apr 2008 09:00 
Offline
HAVP Developer

Joined: 27 Feb 2006 18:12
Posts: 687
Location: Finland
Ok sorry for not being clear. Linux+tmpfs+HAVP.


Top
 Profile  
 
PostPosted: 20 Apr 2008 04:56 
Offline

Joined: 01 Sep 2007 01:02
Posts: 18
After some research I've decided that tmpfs for the squid store wasn't necessary for my needs. I've settled instead on the following memory usage configuration:

# Memory usage values
cache_mem 4096 MB
maximum_object_size 128 KB
memory_pools on
memory_replacement_policy heap GDSF

# no disk store
cache_dir null /null

I only cache small objects to memory and disable the disk store entirely. So far this has been working well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group