Friday, September 26, 2008

Tweaking DNS cache in Windows XP

i found this registry tweak for dns cache in windows xp but don't really know it works or not... give a try

edit your registry or put in registry file:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters] "CacheHashTableBucketSize"=dword:00000001

"CacheHashTableSize"=dword:00000180
"MaxCacheEntryTtlLimit"=dword:0000fa00 "MaxSOACacheEntryTtlLimit"=dword:0000012d

Tuesday, September 23, 2008

Linux Memory Handling And Performance

I am having performance problems. The memory runs down to where it requires swapping, and then the system is very slow. Using "top" I can see that the memory does not get released after an HDF5 file is closed. It stays in memory until the file is deleted.

The memory usage shown by "top" means total memory used by the system, both kernel and users. The Linux OS, contrary to many other Operating Systems, does not impose an upper limit on Kernel memory. If the kernel needs more memory, it grabs as much as there is physical memory. Output to disk is buffered in kernel memory first, before making its way slowly to disk. If a program is output intensive, it can quickly use up all physical memory. At that point, the whole system is memory starved. Not much gets done until the output data is written to the disks and frees up memory. Therefore, a Linux system can become very inefficient by just one write-intensive application.

This problem is not limited to HDF5 programs. Any write-intensive program can exhibit the same phenomenon. For example, keep "top" running in one window and do the following in another window. You will see the same behavior, assuming you have less than 2GB of memory. If you have more memory, increase the value of count=200 to exceed it.

% dd if=/dev/zero of=junk bs=10MB count=200  #generate a 2000MB file
% # by now top will show not much free memory left.
% rm junk
You will then see a big jump of free memory because the data in the dirty buffers is no longer valid and the memory is free for other use.

I believe it's a system problem, not the HDF5 library. I'm just looking for a manual flush that would alleviate my problem.

"Flushing" data means an application is very paranoid of the data integrity and is willing to initiate a real disk write and WAIT until it is finished. It is a requirement of data integrity at the cost of response speed. You can keep telling the system to flush the data out but the data can only move at the limit of the I/O channel. If you want your memory to be freed up sooner, you would have to employ one or more of the following:

  1. faster disks and faster I/O channel;
  2. more memory;
  3. more disks and use stripping;

Wednesday, September 3, 2008

Save bandwidth and time with apt-proxy

If you have more than one box to update or install software with apt on, apt-proxy can save you a lot of time (and bandwidth). It runs on one box, and others are then set up to update through it. Updates are then stored on the apt-proxy box so that any others that also update can do so a lot quicker than getting them from the mirrors. It also releives a bit of the strain on the mirrors you are using. This is how to set up on ubuntu 6.0.6:

Install apt-proxy:

sudo apt-get install apt-proxy

Once installed, configure your apt-proxy config to taste:

sudo vi /etc/apt-proxy/apt-proxy-v2.conf
#This is mine, but you may want to adjust for your mirrors (its also pretty close to default):
address = 192.168.31.190
port = 9999
min_refresh_delay = 1s
timeout = 15
cache_dir = /var/cache/apt-proxy
cleanup_freq = 1d
max_age = 120d
max_versions = 3
[ubuntu]
;; Ubuntu archive
backends = http://gb.archive.ubuntu.com/ubuntu
[ubuntu-security]
;; Ubuntu security updates
backends = http://security.ubuntu.com/ubuntu

Once you have done this, adjust your other boxen so that their /etc/apt/sources.list looks similar to:

deb http://192.168.31.190:9999/ubuntu dapper main restricted universe multiverse
deb-src http://192.168.31.190:9999/ubuntu dapper-security main restricted
deb http://192.168.31.190:9999/ubuntu dapper-security main restricted universe multiverse

One more change needed, on the clients again, edit the /etc/apt/apt.conf file:

#Acquire::http::Proxy "false"; #This needs to be commented in ubuntu.
Acquire::Proxy "false";

After that, just apt-get update as usual, the first box should be the same as normal, but after that, you should see a massive rise in speed for the others doing the same updates.

Note that feisty doesnt have this line, but dapper does, you'll need to adjust depending on your distro (cheers miles!).

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...