Archive for July, 2006

Performing a HTTP/1.1 query using telnet

No Comments »

If you are planning to test a remote or local web server running on 80 port it could be easily done by using telnet command from the linux shell or windows command line.

telnet www.yahoo.com 80
GET / HTTP/1.1
Host: www.yahoo.com

and hit enter two times and voila :)


Perfect http daemon for large file serving

1 Comment »

We will soon perform some benchmarking with thttpd and large file serving, but I am confident that it will be one of the best.

Why? Because it’s FAST and I mean it…:

  • it doesn’t fork
  • perfect memory management
  • small runtime
  • implements http 1.1 protocol with minimum requirements
  • secure and robust

Checking web server header

No Comments »

You can easily check a web server header using a simple telnet utility.

telnet www.yahoo.com 80
HEAD / HTTP/1.0

and hit Enter two times.

You will get a header response with the HTTP status code….

HTTP/1.1 200 OK
Date: Mon, 31 Jul 2006 05:47:22 GMT
P3P: policyref=”http://p3p.yahoo.com/w3c/p3p.xml”, CP=”CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV”
Cache-Control: private
Vary: User-Agent
Set-Cookie: FPB=7cum1i2o812cr6ba; expires=Thu, 01 Jun 2006 19:00:00… Read the rest of this entry »


Apache mod_mmap_static for super performance

1 Comment »

Ok here is the deal if you do not want to switch to other web server software (e.g. Cherokee, thttpd, roxen, boa, lighttpd) and want the best performance for serving static files that do not often change the best solution is to use mod_mmap_static module. This module is not compiled in by default and you will need to recompile apache to enable it:

–enable-module=mmap_static

Don’t forget if any of your web files change – you will need to restart Apache web server…. it’s up to you now – use it or not :)


MaxClients setting for Apache web server

1 Comment »

In httpd.conf there is a directive MaxClients that is usually defined ~ 150. This value allows to serve more simultaneous requests and process queue more faster.

Please note that you will need to recompile apache httpd (you must edit the HARD_SERVER_LIMIT entry in httpd.h and recompile) in order to set it higher that 256. Remember that each daemon requires more memory and an average figure for each process is 4…8MB. For example, you can set-up MaxClients value to ~250 if you have a 1GB of RAM.


Apache modules and performance

No Comments »

For best performance you need to strip down your apache binary – the less modules, the less memory used the better speed / performance you will get. If you are loading modules via DSO you can easily remove module from the loading list by commenting out the LoadModule option. If you have a module linked statically you will need to recompile apache http daemon.
By default 1.3 has compiled in the following modules:

Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.cRead the rest of this entry »


Apache mod_status

No Comments »

If you have mod_status support compiled in your apache (either statically or using DSO) and activated in httpd.conf file with ExtendedStatus On you are probably affecting your site and server performance because every request to apache (e.g. web site hit) will generate multiple queries to gettimeofday or times function/system call depending on your Operating System.Make sure it’s turned off for the best performance:

ExtendedStatus off

in your httpd.conf file


Apache MaxKeepAliveRequests

2 Comments »

The option MaxKeepAliveRequests specifies the number of requests allowed per connection when the KeepAlive on has been set. When the value of this option is set to 0 then unlimited requests are allowed on the server.

For better server performance, it’s recommended to allow unlimited requests or you can always define it with a high value, for example, 10,000.


Boosting apache performance. Keepalive On or Off ?

3 Comments »

Boosting apache performance in high load environments.

I suggest decreasing timeout value and keepalivetimeout, as well as other values listed and described below.

Original timeout has been set to 300 by default. I suggest decreasing it to 120 (2 minutes) so all connections will timeout after 2 minutes. period.

Timeout 120
By default, keepalive is turned on for apache daemon. This is good, but there are some cases that it should be turned off as there is no gain. Usually this happens when you are serving medium to large files with a lot concurrent connections. Play around and see… Read the rest of this entry »


Quickly securing server config .htaccess and improving performance

No Comments »

If you need to configure your apache via .htaccess file (for example giving custom config overriding feature to non-root users on the system and not to affect/misconfigure other web sites, except their own) config .htaccess is a good solution to solve this problem.

By default, I suggest turning off override for root directory:
<Directory>
AllowOverride None

</Directory>

and only activating .htaccess file overring feature for required directory or web site:
<Directory /etc/webs/www.domain.com/public_html/>
AllowOverride All

</Directory>

In the above case, we allow AllowOverride All to /etc/webs/www.domain.com/public_html/ folder.

If we define/enable .htaccess to the exact dir we require it to… Read the rest of this entry »