Friday Jul 17, 2009

Running Open Web Server on MacOS

Running Open Web Server on MacOS 

I tried to run Open Web Server on iMac with Mac OS X 10.5.7 on it.

Install http://svn.macports.org/repository/macports/downloads/MacPorts-1.7.1/MacPorts-1.7.1-10.5-Leopard.dmg as per http://www.macports.org/install.php

Already existing Components

To build Open Web Server, first we need to have a few components. I already have /usr/bin/make, JAVA SE(/usr/bin/javac etc.), /usr/bin/ant, C/C+ compiler(/usr/bin/gcc and /usr/bin/g++),/usr/bin/perl, /usr/bin/cvs, /usr/lib/libz.\*, /usr/lib/libsasl2.\*, installed. Double check these component versions as per the table given in http://wikis.sun.com/display/wsFOSS/Checkout+and+Build+Instructions#CheckoutandBuildInstructions-RequiredLibrariesandTools

Install Mercurial, NSS, NSPR, Xerces C++, Xalan C++, PCRE, ICU

sudo port install mercurial nspr nss pcre icu xercesc xalanc

Building and Installing Mozilla LDAP C SDK

  • cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -P -rLDAPCSDK_6_0_5_RTM DirectorySDKSourceC
  • cd mozilla/directory/c-sdk
  • ./configure --with-sasl --with-nspr-inc=/opt/local/include/nspr --with-nspr-lib=/opt/local/lib/nspr --with-nspr --with-nss-inc=/opt/local/include/nss --with-nss-lib=/opt/local/lib/nss --with-nss
  • make
  • cd ../../dist/
  • sudo mkdir /usr/local/include/mozldap /usr/local/lib/mozldap
  • sudo cp public/ldap/\* /usr/local/include/mozldap/
  • sudo cp lib/\* /usr/local/lib/mozldap/

Building Open Web Server

  • cd
  • hg clone ssh://anon@hg.opensolaris.org/hg/webstack/webserver
  • cd webserver
  • Download and apply this patch
  • make
  • make install
  • cd work/Darwin9.7.0_DBG.OBJ/https-test/bin
  • Manually substitute in startserv script, LD_LIBARAY_PATH to DYLD_LIBRARY_PATH before starting the server. Make similar changes in all the scripts like stopserv.
  • ./startserv

As you can see the server starts up on port 8080.

Note that

I am using "_xpatomic_locked.h" for now. Their performance needs to be optimized using functions in /usr/include/libkern/OSAtomic.h.
NSPR's PR_GetLibraryFilePathname dumps if called with NULL as first argument on MAC so added a hack of PR_GetLibraryFilePathname("ns-httpd40"..).
Some filenames are ugly like defines___.mk will fix it later.

If you see entries in error log like :

failure : HTTP3360: connection limit (1) exceeded.
PollManager::RequestReservation() keep-alive subsystem full

Run Web Server in finest log level ( set <log-level>finest</log-level> in server/xml). And look for messages like
fine: operating system file descriptor limit is 256
fine: allocating 1 file descriptors to the connection queue, 1 file descriptors to keep-alive connections, and 1 file descriptors to the file cache

fine: 130 connection maximum (1 queued, 128 active, 1 keep-alive)
fine: HTTP3066: HTTP keep-alive subsystem will accomodate up to 1 connections

$ulimit -a
open files                      (-n) 256
...
Now I changed it to 1024 :
$ulimit -n 1024

$./https-test/bin/startserv
fine: operating system file descriptor limit is 1024
fine: allocating 128 file descriptors to the connection queue, 128 file descriptors to keep-alive connections, and 8 file descriptors to the file cache
fine: 384 connection maximum (128 queued, 128 active, 128 keep-alive)
fine: HTTP3066: HTTP keep-alive subsystem will accomodate up to 128 connections

References

  1. Build instructions for Open Web Server
  2. https://bugzilla.mozilla.org/show_bug.cgi?id=504893
  3. http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/barrier.3.html
  4. http://devworld.apple.com/technotes/tn2002/tn2071.html
  5. http://lists.apple.com/archives/unix-porting/2002/Sep/msg00021.html
  6. http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg16863.html
  7. http://blogs.sun.com/Janice/entry/http3360_connection_limit_1_exceeded
About

Meena Vyas

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today