Thursday, June 28, 2007

How Download Accelerator Works

Do you know how Download Accelerator Plus works. Let's go under the hood to find out.

Two weeks ago I posted the Understanding Protocols by using Sockspy to capture the various protocols (HTTP, IMAP4, POP3) in action. What we can do is to launch sockspy as a HTTP proxy and configure Download Accelerator to point to the localhost proxy.

I chose Tcl 8.4.15 source at http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz. This tarball is 3635163 bytes in size. If you were to do a HTTP HEAD on this URL, you will see the HTTP/1.1 Accept-Range values is bytes. What this mean is that web client may generate byte-range requests and that's what DAP does.

$ curl --head http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz
HTTP/1.1 200 OK
Date: Wed, 27 Jun 2007 15:04:33 GMT
Server: Apache/2.0.59 (Unix)
Last-Modified: Fri, 25 May 2007 16:32:11 GMT
ETag: "76ed8-3777db-4314df0eab8c0"
Accept-Ranges: bytes
Content-Length: 3635163
Connection: close
Content-Type: application/x-gzip

Do you know how DAP find out other mirror site before you start pushing the button to start the download. Below show the details of the HTTP requests from DAP and all the worker threads in requesting byte-range of the same file.

...
...
GET http://mirrorsearch.speedbit.com/cgi-bin/MirrorSearch.dll?ver10?Scheme=3&Site=jaist.dl.sourceforge.net&Path=/sourceforge/tcl/tcl8.4.15-src.tar.gz&Filename=tcl8.4.15-src.tar.gz&Size=4294967295&SizeHigh=4294967295&Pos=0&PosHigh=0&Country=&Region=&R=0&Advanced=1&Checksum=&BPS=1500000&V=8.0.4.8&DMD=1ee385283c6b5d14760142438cdd5044&D4=RVVeDg==&REF=&MID=e0Q5QTM2RTQ0LUVCRkItNGY5MS1BNTdFLTIwNjYyOTIxQURGOX17Qzg3MzZGNDUtMUU0RC00ZjcyLUI1REMtMEMyMUY2N0Y0REQwfQ==&SS=yEEuRJDfCkD1xEDDAQDJFIGAtgYAAAAAeH5BRJDfCkD1xUDDAQDJFIGAtgYAAAAADvyfRJDfCkD1xUDDAQDJFIGAtgYAAAAAknuCRpDfCkD1xUDDAQDJFIGAtgYBAAAA&SE=AA0AKgQAAAMABAQAA5l7gkboAAIABQQAABYAUgIAABcAIAQAACAALp+AACAARgQAACQARgMAACQARgIAACYALi8nACIAUgIAACMAUgMAACwALjQnACwAMwQAAC0AYwQAAC0AWwQAAC8ANwQAATAAN7sEATQANwEAATYAWwEAADYAZAIAADYAYwIAADYAWwIAABQALyonABQADgQAAR0ADgEAAB0ADgIAAB0AKgQAASMAKscEAS4AIAEAAC4AIAIAADAAKgIAADoALyonADoADgQAAQoADgEAAAoADgIAAAoAKgQA&SN=1&SV=3&TS_DInfo=tFgAAAAAAAAAAAAAAAAAAK58gkY=&TS_HAS=12.000211&TS_LAS=0.325744&TS_AAS=3.
407512 HTTP/1.1
Host: mirrorsearch.speedbit.com
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) (L0)
Connection: Close
Range: bytes=0-
...
...
GET http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz HTTP/1.1
Host: jaist.dl.sourceforge.net
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Connection: Keep-Alive
Range: bytes=727031-1454064
Cookie: __utma=191645736.1777715428.1173594885.1173594885.1173594885.1; __utmz=191645736.1173594885.1.1.utmccn=(referral)|utmcsr=freemind.sourceforge.net|utmcct=/wiki/index.php/Main_Page|utmcmd=referral
...
...
GET http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz HTTP/1.1
Host: jaist.dl.sourceforge.net
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Connection: Keep-Alive
Range: bytes=1454064-2181097
Cookie: __utma=191645736.1777715428.1173594885.1173594885.1173594885.1; __utmz=191645736.1173594885.1.1.utmccn=(referral)|utmcsr=freemind.sourceforge.net|utmcct=/wiki/index.php/Main_Page|utmcmd=referral
...
...
GET http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz HTTP/1.1
Host: jaist.dl.sourceforge.net
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Connection: Keep-Alive
Range: bytes=2181097-2908130
Cookie: __utma=191645736.1777715428.1173594885.1173594885.1173594885.1; __utmz=191645736.1173594885.1.1.utmccn=(referral)|utmcsr=freemind.sourceforge.net|utmcct=/wiki/index.php/Main_Page|utmcmd=referral
...
...
GET http://jaist.dl.sourceforge.net/sourceforge/tcl/tcl8.4.15-src.tar.gz HTTP/1.1
Host: jaist.dl.sourceforge.net
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Connection: Keep-Alive
Range: bytes=2908130-3635162
Cookie: __utma=191645736.1777715428.1173594885.1173594885.1173594885.1; __utmz=191645736.1173594885.1.1.utmccn=(referral)|utmcsr=freemind.sourceforge.net|utmcct=/wiki/index.php/Main_Page|utmcmd=referral

I am able to use Tcl and curl to simulate this. See these blogs that I posted two years ago - DAP using Curl, DAP using Tcl, with benchmark result.

Labels: , , ,

Monday, June 18, 2007

Generic Web-based Plotting Tool using RRDtool

This web-based plotting utility has been evolved from a simple line plotting tool (see Part 1, Part 2) to a very generic web frontend based on RRDtool. It is able to plot any type of 2-D data ( GAUGE or COUNTER), whether the timestamp is in epoch or ISO 8601

To plot cpu utilisation, the user/sys/wio/idle portion stacking on top of one another.

To plot network utilisation, we can introduce a factor of 8 (converting bytes to bits) for the inOctets and -8 for outOctets so that the ingoing and outgoing network traffics are separate by the zero axis.

BTW, the whole implementation is carried using:

Labels: , , ,

Sunday, June 17, 2007

Understanding Protocols

Sockspy (a Tcl application) helps me to understand web protocols such as HTTP, IMAP4, POP3, ...

For HTTP, setup sockspy as http proxy:

set up browser to use the localhost port 8080 as the proxy. The below screen dump captured all the http traffic when I visited Singapore Infomap.

For POP3, setup your local host file to point your POP3 domainname to be 127.0.0.1 (localhost) and have sockspy point point to the IP address.

Captured POP3 traffic is shown and you can see that the username and password are sent in plain text.

Captured IMAP4 traffic is shown below

By understanding the protocols, one should be able to simulate the relevant protocol traffic using a simple telnet client.
Eg. To simulate a HTTP GET

$ telnet www.sg 80
Trying 160.96.178.46...
Connected to www.sg.
Escape character is '^]'.
GET / HTTP/1.1
Host: www.sg

HTTP/1.1 200 OK
Cache-Control: max-age=1800
Expires: Sun, 17 Jun 2007 15:30:09 GMT
Content-Location: http://www.sg/index.html
Date: Sun, 17 Jun 2007 15:00:09 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Fri, 09 Feb 2007 08:33:24 GMT
ETag: "52feb8f6244cc71:15d2"
Content-Length: 204

<html>
<head>
<title>Singapore Infomap</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV=Refresh CONTENT="0; URL=http://app.www.sg">
</head>
</html>

The reply from the telnet simulation is the same as what we captured using sockspy.

Labels: , , ,

Tuesday, June 12, 2007

Apache 2.2 Module-Directive Mapping

One of the high profile projects require performance tuning for the Apache 2.x running on Solaris 10. I have no problem in tuning the Solaris operating system.

So how about Apache. My approach will be to conduct a minimisation follow by tuning the MaxClients and other related parameters for the default prefork model. However, in order to determine which modules not to be included in the httpd.conf, we need to find out the mapping between module and it's respective directives. I was not able to find anything from the Internet and therefore I decided to work it out myself.

The Apache 2.2 documentation is written as a set of XHTML document and this make life a lot easier. With Tcl and tDOM (DOM implementation in Tcl), I am able to parse the XHTML files and dynamically work out the mapping relationship. With this mapping, I can confidently take out those modules that I do not need in the httpd.conf.

One thing that we need to watch out is that the XHTML file has a default XML namespace like this:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
In the below Tcl program, I will have to assign my own namespace to avoid using local-name() in the XPath predicate.

package require http
package require tdom

set baseurl "http://httpd.apache.org/docs/2.2/mod/"
set s [http::geturl $baseurl]
set doc0 [dom parse [http::data $s]]
set root0 [$doc0 documentElement]
set xmlns0 [$root0 getAttribute xmlns]
http::cleanup $s

foreach module [$root0 selectNodes -namespace "ns $xmlns0" {//ns:dl/ns:dt/ns:a}] {
 set modlink [$module getAttribute href]
 set modname [[$module childNodes] nodeValue]

 # process each module
 set s [http::geturl $baseurl$modlink]
 set doc [dom parse [http::data $s]]
 set root [$doc documentElement]
 set xmlns [$root getAttribute xmlns]
 http::cleanup $s
 #
 foreach directive [$root selectNodes -namespaces "ns $xmlns0" \
  {//ns:div[@id="quickview"]/ns:ul[@id="toc"]/ns:li/ns:a/text()}] {
  puts "$modname [$directive nodeValue]"
 }
 $doc delete
}

Output of the module-directive mapping by :

$ tclsh module.tcl | sort | tee bymodule.txt
beos CoreDumpDirectory
beos Group
beos Listen
beos ListenBacklog
beos MaxClients
beos MaxMemFree
beos MaxRequestsPerThread
beos MaxSpareThreads
beos MinSpareThreads
beos PidFile
beos ReceiveBufferSize
beos ScoreBoardFile
beos SendBufferSize
beos StartThreads
beos User
core 
core 
core 
core 
core 
core 
core 
core 
core 
core 
core 
core AcceptFilter
core AcceptPathInfo
core AccessFileName
core AddDefaultCharset
core AddOutputFilterByType
core AllowEncodedSlashes
core AllowOverride
core AuthName
core AuthType
core CGIMapExtension
core ContentDigest
core DefaultType
core DocumentRoot
core EnableMMAP
core EnableSendfile
core ErrorDocument
core ErrorLog
core FileETag
core ForceType
core HostnameLookups
core Include
core KeepAlive
core KeepAliveTimeout
core LimitInternalRecursion
core LimitRequestBody
core LimitRequestFieldSize
core LimitRequestFields
core LimitRequestLine
core LimitXMLRequestBody
core LogLevel
core MaxKeepAliveRequests
core NameVirtualHost
core Options
core RLimitCPU
core RLimitMEM
core RLimitNPROC
core Require
core Satisfy
core ScriptInterpreterSource
core ServerAdmin
core ServerAlias
core ServerName
core ServerPath
core ServerRoot
core ServerSignature
core ServerTokens
core SetHandler
core SetInputFilter
core SetOutputFilter
core TimeOut
core TraceEnable
core UseCanonicalName
core UseCanonicalPhysicalPort
event AcceptMutex
event CoreDumpDirectory
event EnableExceptionHook
event Group
event Listen
event ListenBacklog
event LockFile
event MaxClients
event MaxMemFree
event MaxRequestsPerChild
event MaxSpareThreads
event MinSpareThreads
event PidFile
event ScoreBoardFile
event SendBufferSize
event ServerLimit
event StartServers
event ThreadLimit
event ThreadStackSize
event ThreadsPerChild
event User
mod_actions Action
mod_actions Script
mod_alias Alias
mod_alias AliasMatch
mod_alias Redirect
mod_alias RedirectMatch
mod_alias RedirectPermanent
mod_alias RedirectTemp
mod_alias ScriptAlias
mod_alias ScriptAliasMatch
mod_auth_basic AuthBasicAuthoritative
mod_auth_basic AuthBasicProvider
mod_auth_digest AuthDigestAlgorithm
mod_auth_digest AuthDigestDomain
mod_auth_digest AuthDigestNcCheck
mod_auth_digest AuthDigestNonceFormat
mod_auth_digest AuthDigestNonceLifetime
mod_auth_digest AuthDigestProvider
mod_auth_digest AuthDigestQop
mod_auth_digest AuthDigestShmemSize
mod_authn_alias 
mod_authn_anon Anonymous
mod_authn_anon Anonymous_LogEmail
mod_authn_anon Anonymous_MustGiveEmail
mod_authn_anon Anonymous_NoUserID
mod_authn_anon Anonymous_VerifyEmail
mod_authn_dbd AuthDBDUserPWQuery
mod_authn_dbd AuthDBDUserRealmQuery
mod_authn_dbm AuthDBMType
mod_authn_dbm AuthDBMUserFile
mod_authn_default AuthDefaultAuthoritative
mod_authn_file AuthUserFile
mod_authnz_ldap AuthLDAPBindDN
mod_authnz_ldap AuthLDAPBindPassword
mod_authnz_ldap AuthLDAPCharsetConfig
mod_authnz_ldap AuthLDAPCompareDNOnServer
mod_authnz_ldap AuthLDAPDereferenceAliases
mod_authnz_ldap AuthLDAPGroupAttribute
mod_authnz_ldap AuthLDAPGroupAttributeIsDN
mod_authnz_ldap AuthLDAPRemoteUserAttribute
mod_authnz_ldap AuthLDAPRemoteUserIsDN
mod_authnz_ldap AuthLDAPUrl
mod_authnz_ldap AuthzLDAPAuthoritative
mod_authz_dbm AuthDBMGroupFile
mod_authz_dbm AuthzDBMAuthoritative
mod_authz_dbm AuthzDBMType
mod_authz_default AuthzDefaultAuthoritative
mod_authz_groupfile AuthGroupFile
mod_authz_groupfile AuthzGroupFileAuthoritative
mod_authz_host Allow
mod_authz_host Deny
mod_authz_host Order
mod_authz_owner AuthzOwnerAuthoritative
mod_authz_user AuthzUserAuthoritative
mod_autoindex AddAlt
mod_autoindex AddAltByEncoding
mod_autoindex AddAltByType
mod_autoindex AddDescription
mod_autoindex AddIcon
mod_autoindex AddIconByEncoding
mod_autoindex AddIconByType
mod_autoindex DefaultIcon
mod_autoindex HeaderName
mod_autoindex IndexIgnore
mod_autoindex IndexOptions
mod_autoindex IndexOrderDefault
mod_autoindex IndexStyleSheet
mod_autoindex ReadmeName
mod_cache CacheDefaultExpire
mod_cache CacheDisable
mod_cache CacheEnable
mod_cache CacheIgnoreCacheControl
mod_cache CacheIgnoreHeaders
mod_cache CacheIgnoreNoLastMod
mod_cache CacheLastModifiedFactor
mod_cache CacheMaxExpire
mod_cache CacheStoreNoStore
mod_cache CacheStorePrivate
mod_cern_meta MetaDir
mod_cern_meta MetaFiles
mod_cern_meta MetaSuffix
mod_cgi ScriptLog
mod_cgi ScriptLogBuffer
mod_cgi ScriptLogLength
mod_cgid ScriptLog
mod_cgid ScriptLogBuffer
mod_cgid ScriptLogLength
mod_cgid ScriptSock
mod_charset_lite CharsetDefault
mod_charset_lite CharsetOptions
mod_charset_lite CharsetSourceEnc
mod_dav Dav
mod_dav DavDepthInfinity
mod_dav DavMinTimeout
mod_dav_fs DavLockDB
mod_dav_lock DavGenericLockDB
mod_dbd DBDExptime
mod_dbd DBDKeep
mod_dbd DBDMax
mod_dbd DBDMin
mod_dbd DBDParams
mod_dbd DBDPersist
mod_dbd DBDPrepareSQL
mod_dbd DBDriver
mod_deflate DeflateBufferSize
mod_deflate DeflateCompressionLevel
mod_deflate DeflateFilterNote
mod_deflate DeflateMemLevel
mod_deflate DeflateWindowSize
mod_dir DirectoryIndex
mod_dir DirectorySlash
mod_disk_cache CacheDirLength
mod_disk_cache CacheDirLevels
mod_disk_cache CacheMaxFileSize
mod_disk_cache CacheMinFileSize
mod_disk_cache CacheRoot
mod_dumpio DumpIOInput
mod_dumpio DumpIOLogLevel
mod_dumpio DumpIOOutput
mod_echo ProtocolEcho
mod_env PassEnv
mod_env SetEnv
mod_env UnsetEnv
mod_example Example
mod_expires ExpiresActive
mod_expires ExpiresByType
mod_expires ExpiresDefault
mod_ext_filter ExtFilterDefine
mod_ext_filter ExtFilterOptions
mod_file_cache CacheFile
mod_file_cache MMapFile
mod_filter FilterChain
mod_filter FilterDeclare
mod_filter FilterProtocol
mod_filter FilterProvider
mod_filter FilterTrace
mod_headers Header
mod_headers RequestHeader
mod_ident IdentityCheck
mod_ident IdentityCheckTimeout
mod_imagemap ImapBase
mod_imagemap ImapDefault
mod_imagemap ImapMenu
mod_include SSIEndTag
mod_include SSIErrorMsg
mod_include SSIStartTag
mod_include SSITimeFormat
mod_include SSIUndefinedEcho
mod_include XBitHack
mod_info AddModuleInfo
mod_isapi ISAPIAppendLogToErrors
mod_isapi ISAPIAppendLogToQuery
mod_isapi ISAPICacheFile
mod_isapi ISAPIFakeAsync
mod_isapi ISAPILogNotSupported
mod_isapi ISAPIReadAheadBuffer
mod_ldap LDAPCacheEntries
mod_ldap LDAPCacheTTL
mod_ldap LDAPConnectionTimeout
mod_ldap LDAPOpCacheEntries
mod_ldap LDAPOpCacheTTL
mod_ldap LDAPSharedCacheFile
mod_ldap LDAPSharedCacheSize
mod_ldap LDAPTrustedClientCert
mod_ldap LDAPTrustedGlobalCert
mod_ldap LDAPTrustedMode
mod_ldap LDAPVerifyServerCert
mod_log_config BufferedLogs
mod_log_config CookieLog
mod_log_config CustomLog
mod_log_config LogFormat
mod_log_config TransferLog
mod_log_forensic ForensicLog
mod_mem_cache MCacheMaxObjectCount
mod_mem_cache MCacheMaxObjectSize
mod_mem_cache MCacheMaxStreamingBuffer
mod_mem_cache MCacheMinObjectSize
mod_mem_cache MCacheRemovalAlgorithm
mod_mem_cache MCacheSize
mod_mime AddCharset
mod_mime AddEncoding
mod_mime AddHandler
mod_mime AddInputFilter
mod_mime AddLanguage
mod_mime AddOutputFilter
mod_mime AddType
mod_mime DefaultLanguage
mod_mime ModMimeUsePathInfo
mod_mime MultiviewsMatch
mod_mime RemoveCharset
mod_mime RemoveEncoding
mod_mime RemoveHandler
mod_mime RemoveInputFilter
mod_mime RemoveLanguage
mod_mime RemoveOutputFilter
mod_mime RemoveType
mod_mime TypesConfig
mod_mime_magic MimeMagicFile
mod_negotiation CacheNegotiatedDocs
mod_negotiation ForceLanguagePriority
mod_negotiation LanguagePriority
mod_nw_ssl NWSSLTrustedCerts
mod_nw_ssl NWSSLUpgradeable
mod_nw_ssl SecureListen
mod_proxy 
mod_proxy 
mod_proxy AllowCONNECT
mod_proxy NoProxy
mod_proxy ProxyBadHeader
mod_proxy ProxyBlock
mod_proxy ProxyDomain
mod_proxy ProxyErrorOverride
mod_proxy ProxyIOBufferSize
mod_proxy ProxyMaxForwards
mod_proxy ProxyPass
mod_proxy ProxyPassReverse
mod_proxy ProxyPassReverseCookieDomain
mod_proxy ProxyPassReverseCookiePath
mod_proxy ProxyPreserveHost
mod_proxy ProxyReceiveBufferSize
mod_proxy ProxyRemote
mod_proxy ProxyRemoteMatch
mod_proxy ProxyRequests
mod_proxy ProxyTimeout
mod_proxy ProxyVia
mod_rewrite RewriteBase
mod_rewrite RewriteCond
mod_rewrite RewriteEngine
mod_rewrite RewriteLock
mod_rewrite RewriteLog
mod_rewrite RewriteLogLevel
mod_rewrite RewriteMap
mod_rewrite RewriteOptions
mod_rewrite RewriteRule
mod_setenvif BrowserMatch
mod_setenvif BrowserMatchNoCase
mod_setenvif SetEnvIf
mod_setenvif SetEnvIfNoCase
mod_so LoadFile
mod_so LoadModule
mod_speling CheckCaseOnly
mod_speling CheckSpelling
mod_ssl SSLCACertificateFile
mod_ssl SSLCACertificatePath
mod_ssl SSLCADNRequestFile
mod_ssl SSLCADNRequestPath
mod_ssl SSLCARevocationFile
mod_ssl SSLCARevocationPath
mod_ssl SSLCertificateChainFile
mod_ssl SSLCertificateFile
mod_ssl SSLCertificateKeyFile
mod_ssl SSLCipherSuite
mod_ssl SSLCryptoDevice
mod_ssl SSLEngine
mod_ssl SSLHonorCipherOrder
mod_ssl SSLMutex
mod_ssl SSLOptions
mod_ssl SSLPassPhraseDialog
mod_ssl SSLProtocol
mod_ssl SSLProxyCACertificateFile
mod_ssl SSLProxyCACertificatePath
mod_ssl SSLProxyCARevocationFile
mod_ssl SSLProxyCARevocationPath
mod_ssl SSLProxyCipherSuite
mod_ssl SSLProxyEngine
mod_ssl SSLProxyMachineCertificateFile
mod_ssl SSLProxyMachineCertificatePath
mod_ssl SSLProxyProtocol
mod_ssl SSLProxyVerify
mod_ssl SSLProxyVerifyDepth
mod_ssl SSLRandomSeed
mod_ssl SSLRequire
mod_ssl SSLRequireSSL
mod_ssl SSLSessionCache
mod_ssl SSLSessionCacheTimeout
mod_ssl SSLUserName
mod_ssl SSLVerifyClient
mod_ssl SSLVerifyDepth
mod_status ExtendedStatus
mod_suexec SuexecUserGroup
mod_userdir UserDir
mod_usertrack CookieDomain
mod_usertrack CookieExpires
mod_usertrack CookieName
mod_usertrack CookieStyle
mod_usertrack CookieTracking
mod_version 
mod_vhost_alias VirtualDocumentRoot
mod_vhost_alias VirtualDocumentRootIP
mod_vhost_alias VirtualScriptAlias
mod_vhost_alias VirtualScriptAliasIP
mpm_common AcceptMutex
mpm_common CoreDumpDirectory
mpm_common EnableExceptionHook
mpm_common GracefulShutdownTimeout
mpm_common Group
mpm_common Listen
mpm_common ListenBackLog
mpm_common LockFile
mpm_common MaxClients
mpm_common MaxMemFree
mpm_common MaxRequestsPerChild
mpm_common MaxSpareThreads
mpm_common MinSpareThreads
mpm_common PidFile
mpm_common ReceiveBufferSize
mpm_common ScoreBoardFile
mpm_common SendBufferSize
mpm_common ServerLimit
mpm_common StartServers
mpm_common StartThreads
mpm_common ThreadLimit
mpm_common ThreadStackSize
mpm_common ThreadsPerChild
mpm_common User
mpm_netware Listen
mpm_netware ListenBacklog
mpm_netware MaxMemFree
mpm_netware MaxRequestsPerChild
mpm_netware MaxSpareThreads
mpm_netware MaxThreads
mpm_netware MinSpareThreads
mpm_netware ReceiveBufferSize
mpm_netware SendBufferSize
mpm_netware StartThreads
mpm_netware ThreadStackSize
mpm_winnt CoreDumpDirectory
mpm_winnt Listen
mpm_winnt ListenBacklog
mpm_winnt MaxMemFree
mpm_winnt MaxRequestsPerChild
mpm_winnt PidFile
mpm_winnt ReceiveBufferSize
mpm_winnt ScoreBoardFile
mpm_winnt SendBufferSize
mpm_winnt ThreadLimit
mpm_winnt ThreadStackSize
mpm_winnt ThreadsPerChild
mpm_winnt Win32DisableAcceptEx
mpmt_os2 Group
mpmt_os2 Listen
mpmt_os2 ListenBacklog
mpmt_os2 MaxRequestsPerChild
mpmt_os2 MaxSpareThreads
mpmt_os2 MinSpareThreads
mpmt_os2 PidFile
mpmt_os2 ReceiveBufferSize
mpmt_os2 SendBufferSize
mpmt_os2 StartServers
mpmt_os2 User
prefork AcceptMutex
prefork CoreDumpDirectory
prefork EnableExceptionHook
prefork Group
prefork Listen
prefork ListenBacklog
prefork LockFile
prefork MaxClients
prefork MaxMemFree
prefork MaxRequestsPerChild
prefork MaxSpareServers
prefork MinSpareServers
prefork PidFile
prefork ReceiveBufferSize
prefork ScoreBoardFile
prefork SendBufferSize
prefork ServerLimit
prefork StartServers
prefork User
worker AcceptMutex
worker CoreDumpDirectory
worker EnableExceptionHook
worker Group
worker Listen
worker ListenBacklog
worker LockFile
worker MaxClients
worker MaxMemFree
worker MaxRequestsPerChild
worker MaxSpareThreads
worker MinSpareThreads
worker PidFile
worker ReceiveBufferSize
worker ScoreBoardFile
worker SendBufferSize
worker ServerLimit
worker StartServers
worker ThreadLimit
worker ThreadStackSize
worker ThreadsPerChild
worker User

To sort the above based on directive:

$ awk '{print $2, $1}' bymodule.txt | sort | tee bydirective.txt
<AuthnProviderAlias> mod_authn_alias
<Directory> core
<DirectoryMatch> core
<Files> core
<FilesMatch> core
<IfDefine> core
<IfModule> core
<IfVersion> mod_version
<Limit> core
<LimitExcept> core
<Location> core
<LocationMatch> core
<Proxy> mod_proxy
<ProxyMatch> mod_proxy
<VirtualHost> core
AcceptFilter core
AcceptMutex event
AcceptMutex mpm_common
AcceptMutex prefork
AcceptMutex worker
AcceptPathInfo core
AccessFileName core
Action mod_actions
AddAlt mod_autoindex
AddAltByEncoding mod_autoindex
AddAltByType mod_autoindex
AddCharset mod_mime
AddDefaultCharset core
AddDescription mod_autoindex
AddEncoding mod_mime
AddHandler mod_mime
AddIcon mod_autoindex
AddIconByEncoding mod_autoindex
AddIconByType mod_autoindex
AddInputFilter mod_mime
AddLanguage mod_mime
AddModuleInfo mod_info
AddOutputFilter mod_mime
AddOutputFilterByType core
AddType mod_mime
Alias mod_alias
AliasMatch mod_alias
Allow mod_authz_host
AllowCONNECT mod_proxy
AllowEncodedSlashes core
AllowOverride core
Anonymous mod_authn_anon
Anonymous_LogEmail mod_authn_anon
Anonymous_MustGiveEmail mod_authn_anon
Anonymous_NoUserID mod_authn_anon
Anonymous_VerifyEmail mod_authn_anon
AuthBasicAuthoritative mod_auth_basic
AuthBasicProvider mod_auth_basic
AuthDBDUserPWQuery mod_authn_dbd
AuthDBDUserRealmQuery mod_authn_dbd
AuthDBMGroupFile mod_authz_dbm
AuthDBMType mod_authn_dbm
AuthDBMUserFile mod_authn_dbm
AuthDefaultAuthoritative mod_authn_default
AuthDigestAlgorithm mod_auth_digest
AuthDigestDomain mod_auth_digest
AuthDigestNcCheck mod_auth_digest
AuthDigestNonceFormat mod_auth_digest
AuthDigestNonceLifetime mod_auth_digest
AuthDigestProvider mod_auth_digest
AuthDigestQop mod_auth_digest
AuthDigestShmemSize mod_auth_digest
AuthGroupFile mod_authz_groupfile
AuthLDAPBindDN mod_authnz_ldap
AuthLDAPBindPassword mod_authnz_ldap
AuthLDAPCharsetConfig mod_authnz_ldap
AuthLDAPCompareDNOnServer mod_authnz_ldap
AuthLDAPDereferenceAliases mod_authnz_ldap
AuthLDAPGroupAttribute mod_authnz_ldap
AuthLDAPGroupAttributeIsDN mod_authnz_ldap
AuthLDAPRemoteUserAttribute mod_authnz_ldap
AuthLDAPRemoteUserIsDN mod_authnz_ldap
AuthLDAPUrl mod_authnz_ldap
AuthName core
AuthType core
AuthUserFile mod_authn_file
AuthzDBMAuthoritative mod_authz_dbm
AuthzDBMType mod_authz_dbm
AuthzDefaultAuthoritative mod_authz_default
AuthzGroupFileAuthoritative mod_authz_groupfile
AuthzLDAPAuthoritative mod_authnz_ldap
AuthzOwnerAuthoritative mod_authz_owner
AuthzUserAuthoritative mod_authz_user
BrowserMatch mod_setenvif
BrowserMatchNoCase mod_setenvif
BufferedLogs mod_log_config
CGIMapExtension core
CacheDefaultExpire mod_cache
CacheDirLength mod_disk_cache
CacheDirLevels mod_disk_cache
CacheDisable mod_cache
CacheEnable mod_cache
CacheFile mod_file_cache
CacheIgnoreCacheControl mod_cache
CacheIgnoreHeaders mod_cache
CacheIgnoreNoLastMod mod_cache
CacheLastModifiedFactor mod_cache
CacheMaxExpire mod_cache
CacheMaxFileSize mod_disk_cache
CacheMinFileSize mod_disk_cache
CacheNegotiatedDocs mod_negotiation
CacheRoot mod_disk_cache
CacheStoreNoStore mod_cache
CacheStorePrivate mod_cache
CharsetDefault mod_charset_lite
CharsetOptions mod_charset_lite
CharsetSourceEnc mod_charset_lite
CheckCaseOnly mod_speling
CheckSpelling mod_speling
ContentDigest core
CookieDomain mod_usertrack
CookieExpires mod_usertrack
CookieLog mod_log_config
CookieName mod_usertrack
CookieStyle mod_usertrack
CookieTracking mod_usertrack
CoreDumpDirectory beos
CoreDumpDirectory event
CoreDumpDirectory mpm_common
CoreDumpDirectory mpm_winnt
CoreDumpDirectory prefork
CoreDumpDirectory worker
CustomLog mod_log_config
DBDExptime mod_dbd
DBDKeep mod_dbd
DBDMax mod_dbd
DBDMin mod_dbd
DBDParams mod_dbd
DBDPersist mod_dbd
DBDPrepareSQL mod_dbd
DBDriver mod_dbd
Dav mod_dav
DavDepthInfinity mod_dav
DavGenericLockDB mod_dav_lock
DavLockDB mod_dav_fs
DavMinTimeout mod_dav
DefaultIcon mod_autoindex
DefaultLanguage mod_mime
DefaultType core
DeflateBufferSize mod_deflate
DeflateCompressionLevel mod_deflate
DeflateFilterNote mod_deflate
DeflateMemLevel mod_deflate
DeflateWindowSize mod_deflate
Deny mod_authz_host
DirectoryIndex mod_dir
DirectorySlash mod_dir
DocumentRoot core
DumpIOInput mod_dumpio
DumpIOLogLevel mod_dumpio
DumpIOOutput mod_dumpio
EnableExceptionHook event
EnableExceptionHook mpm_common
EnableExceptionHook prefork
EnableExceptionHook worker
EnableMMAP core
EnableSendfile core
ErrorDocument core
ErrorLog core
Example mod_example
ExpiresActive mod_expires
ExpiresByType mod_expires
ExpiresDefault mod_expires
ExtFilterDefine mod_ext_filter
ExtFilterOptions mod_ext_filter
ExtendedStatus mod_status
FileETag core
FilterChain mod_filter
FilterDeclare mod_filter
FilterProtocol mod_filter
FilterProvider mod_filter
FilterTrace mod_filter
ForceLanguagePriority mod_negotiation
ForceType core
ForensicLog mod_log_forensic
GracefulShutdownTimeout mpm_common
Group beos
Group event
Group mpm_common
Group mpmt_os2
Group prefork
Group worker
Header mod_headers
HeaderName mod_autoindex
HostnameLookups core
ISAPIAppendLogToErrors mod_isapi
ISAPIAppendLogToQuery mod_isapi
ISAPICacheFile mod_isapi
ISAPIFakeAsync mod_isapi
ISAPILogNotSupported mod_isapi
ISAPIReadAheadBuffer mod_isapi
IdentityCheck mod_ident
IdentityCheckTimeout mod_ident
ImapBase mod_imagemap
ImapDefault mod_imagemap
ImapMenu mod_imagemap
Include core
IndexIgnore mod_autoindex
IndexOptions mod_autoindex
IndexOrderDefault mod_autoindex
IndexStyleSheet mod_autoindex
KeepAlive core
KeepAliveTimeout core
LDAPCacheEntries mod_ldap
LDAPCacheTTL mod_ldap
LDAPConnectionTimeout mod_ldap
LDAPOpCacheEntries mod_ldap
LDAPOpCacheTTL mod_ldap
LDAPSharedCacheFile mod_ldap
LDAPSharedCacheSize mod_ldap
LDAPTrustedClientCert mod_ldap
LDAPTrustedGlobalCert mod_ldap
LDAPTrustedMode mod_ldap
LDAPVerifyServerCert mod_ldap
LanguagePriority mod_negotiation
LimitInternalRecursion core
LimitRequestBody core
LimitRequestFieldSize core
LimitRequestFields core
LimitRequestLine core
LimitXMLRequestBody core
Listen beos
Listen event
Listen mpm_common
Listen mpm_netware
Listen mpm_winnt
Listen mpmt_os2
Listen prefork
Listen worker
ListenBackLog mpm_common
ListenBacklog beos
ListenBacklog event
ListenBacklog mpm_netware
ListenBacklog mpm_winnt
ListenBacklog mpmt_os2
ListenBacklog prefork
ListenBacklog worker
LoadFile mod_so
LoadModule mod_so
LockFile event
LockFile mpm_common
LockFile prefork
LockFile worker
LogFormat mod_log_config
LogLevel core
MCacheMaxObjectCount mod_mem_cache
MCacheMaxObjectSize mod_mem_cache
MCacheMaxStreamingBuffer mod_mem_cache
MCacheMinObjectSize mod_mem_cache
MCacheRemovalAlgorithm mod_mem_cache
MCacheSize mod_mem_cache
MMapFile mod_file_cache
MaxClients beos
MaxClients event
MaxClients mpm_common
MaxClients prefork
MaxClients worker
MaxKeepAliveRequests core
MaxMemFree beos
MaxMemFree event
MaxMemFree mpm_common
MaxMemFree mpm_netware
MaxMemFree mpm_winnt
MaxMemFree prefork
MaxMemFree worker
MaxRequestsPerChild event
MaxRequestsPerChild mpm_common
MaxRequestsPerChild mpm_netware
MaxRequestsPerChild mpm_winnt
MaxRequestsPerChild mpmt_os2
MaxRequestsPerChild prefork
MaxRequestsPerChild worker
MaxRequestsPerThread beos
MaxSpareServers prefork
MaxSpareThreads beos
MaxSpareThreads event
MaxSpareThreads mpm_common
MaxSpareThreads mpm_netware
MaxSpareThreads mpmt_os2
MaxSpareThreads worker
MaxThreads mpm_netware
MetaDir mod_cern_meta
MetaFiles mod_cern_meta
MetaSuffix mod_cern_meta
MimeMagicFile mod_mime_magic
MinSpareServers prefork
MinSpareThreads beos
MinSpareThreads event
MinSpareThreads mpm_common
MinSpareThreads mpm_netware
MinSpareThreads mpmt_os2
MinSpareThreads worker
ModMimeUsePathInfo mod_mime
MultiviewsMatch mod_mime
NWSSLTrustedCerts mod_nw_ssl
NWSSLUpgradeable mod_nw_ssl
NameVirtualHost core
NoProxy mod_proxy
Options core
Order mod_authz_host
PassEnv mod_env
PidFile beos
PidFile event
PidFile mpm_common
PidFile mpm_winnt
PidFile mpmt_os2
PidFile prefork
PidFile worker
ProtocolEcho mod_echo
ProxyBadHeader mod_proxy
ProxyBlock mod_proxy
ProxyDomain mod_proxy
ProxyErrorOverride mod_proxy
ProxyIOBufferSize mod_proxy
ProxyMaxForwards mod_proxy
ProxyPass mod_proxy
ProxyPassReverse mod_proxy
ProxyPassReverseCookieDomain mod_proxy
ProxyPassReverseCookiePath mod_proxy
ProxyPreserveHost mod_proxy
ProxyReceiveBufferSize mod_proxy
ProxyRemote mod_proxy
ProxyRemoteMatch mod_proxy
ProxyRequests mod_proxy
ProxyTimeout mod_proxy
ProxyVia mod_proxy
RLimitCPU core
RLimitMEM core
RLimitNPROC core
ReadmeName mod_autoindex
ReceiveBufferSize beos
ReceiveBufferSize mpm_common
ReceiveBufferSize mpm_netware
ReceiveBufferSize mpm_winnt
ReceiveBufferSize mpmt_os2
ReceiveBufferSize prefork
ReceiveBufferSize worker
Redirect mod_alias
RedirectMatch mod_alias
RedirectPermanent mod_alias
RedirectTemp mod_alias
RemoveCharset mod_mime
RemoveEncoding mod_mime
RemoveHandler mod_mime
RemoveInputFilter mod_mime
RemoveLanguage mod_mime
RemoveOutputFilter mod_mime
RemoveType mod_mime
RequestHeader mod_headers
Require core
RewriteBase mod_rewrite
RewriteCond mod_rewrite
RewriteEngine mod_rewrite
RewriteLock mod_rewrite
RewriteLog mod_rewrite
RewriteLogLevel mod_rewrite
RewriteMap mod_rewrite
RewriteOptions mod_rewrite
RewriteRule mod_rewrite
SSIEndTag mod_include
SSIErrorMsg mod_include
SSIStartTag mod_include
SSITimeFormat mod_include
SSIUndefinedEcho mod_include
SSLCACertificateFile mod_ssl
SSLCACertificatePath mod_ssl
SSLCADNRequestFile mod_ssl
SSLCADNRequestPath mod_ssl
SSLCARevocationFile mod_ssl
SSLCARevocationPath mod_ssl
SSLCertificateChainFile mod_ssl
SSLCertificateFile mod_ssl
SSLCertificateKeyFile mod_ssl
SSLCipherSuite mod_ssl
SSLCryptoDevice mod_ssl
SSLEngine mod_ssl
SSLHonorCipherOrder mod_ssl
SSLMutex mod_ssl
SSLOptions mod_ssl
SSLPassPhraseDialog mod_ssl
SSLProtocol mod_ssl
SSLProxyCACertificateFile mod_ssl
SSLProxyCACertificatePath mod_ssl
SSLProxyCARevocationFile mod_ssl
SSLProxyCARevocationPath mod_ssl
SSLProxyCipherSuite mod_ssl
SSLProxyEngine mod_ssl
SSLProxyMachineCertificateFile mod_ssl
SSLProxyMachineCertificatePath mod_ssl
SSLProxyProtocol mod_ssl
SSLProxyVerify mod_ssl
SSLProxyVerifyDepth mod_ssl
SSLRandomSeed mod_ssl
SSLRequire mod_ssl
SSLRequireSSL mod_ssl
SSLSessionCache mod_ssl
SSLSessionCacheTimeout mod_ssl
SSLUserName mod_ssl
SSLVerifyClient mod_ssl
SSLVerifyDepth mod_ssl
Satisfy core
ScoreBoardFile beos
ScoreBoardFile event
ScoreBoardFile mpm_common
ScoreBoardFile mpm_winnt
ScoreBoardFile prefork
ScoreBoardFile worker
Script mod_actions
ScriptAlias mod_alias
ScriptAliasMatch mod_alias
ScriptInterpreterSource core
ScriptLog mod_cgi
ScriptLog mod_cgid
ScriptLogBuffer mod_cgi
ScriptLogBuffer mod_cgid
ScriptLogLength mod_cgi
ScriptLogLength mod_cgid
ScriptSock mod_cgid
SecureListen mod_nw_ssl
SendBufferSize beos
SendBufferSize event
SendBufferSize mpm_common
SendBufferSize mpm_netware
SendBufferSize mpm_winnt
SendBufferSize mpmt_os2
SendBufferSize prefork
SendBufferSize worker
ServerAdmin core
ServerAlias core
ServerLimit event
ServerLimit mpm_common
ServerLimit prefork
ServerLimit worker
ServerName core
ServerPath core
ServerRoot core
ServerSignature core
ServerTokens core
SetEnv mod_env
SetEnvIf mod_setenvif
SetEnvIfNoCase mod_setenvif
SetHandler core
SetInputFilter core
SetOutputFilter core
StartServers event
StartServers mpm_common
StartServers mpmt_os2
StartServers prefork
StartServers worker
StartThreads beos
StartThreads mpm_common
StartThreads mpm_netware
SuexecUserGroup mod_suexec
ThreadLimit event
ThreadLimit mpm_common
ThreadLimit mpm_winnt
ThreadLimit worker
ThreadStackSize event
ThreadStackSize mpm_common
ThreadStackSize mpm_netware
ThreadStackSize mpm_winnt
ThreadStackSize worker
ThreadsPerChild event
ThreadsPerChild mpm_common
ThreadsPerChild mpm_winnt
ThreadsPerChild worker
TimeOut core
TraceEnable core
TransferLog mod_log_config
TypesConfig mod_mime
UnsetEnv mod_env
UseCanonicalName core
UseCanonicalPhysicalPort core
User beos
User event
User mpm_common
User mpmt_os2
User prefork
User worker
UserDir mod_userdir
VirtualDocumentRoot mod_vhost_alias
VirtualDocumentRootIP mod_vhost_alias
VirtualScriptAlias mod_vhost_alias
VirtualScriptAliasIP mod_vhost_alias
Win32DisableAcceptEx mpm_winnt
XBitHack mod_include

Let's take a look at the httpd.conf-example (default httpd.conf) file to see what has been loaded in the default configuration.

$ awk '/^[ \t]*#/ || /^[ \t]*$/ {continue} {print}' /etc/apache2/httpd.conf-example
ServerRoot "/usr/apache2"
Listen 80
LoadModule authn_file_module libexec/mod_authn_file.so
LoadModule authn_dbm_module libexec/mod_authn_dbm.so
LoadModule authn_anon_module libexec/mod_authn_anon.so
LoadModule authn_dbd_module libexec/mod_authn_dbd.so
LoadModule authn_default_module libexec/mod_authn_default.so
LoadModule authz_host_module libexec/mod_authz_host.so
LoadModule authz_groupfile_module libexec/mod_authz_groupfile.so
LoadModule authz_user_module libexec/mod_authz_user.so
LoadModule authz_dbm_module libexec/mod_authz_dbm.so
LoadModule authz_owner_module libexec/mod_authz_owner.so
LoadModule authz_default_module libexec/mod_authz_default.so
LoadModule auth_basic_module libexec/mod_auth_basic.so
LoadModule auth_digest_module libexec/mod_auth_digest.so
LoadModule file_cache_module libexec/mod_file_cache.so
LoadModule cache_module libexec/mod_cache.so
LoadModule disk_cache_module libexec/mod_disk_cache.so
LoadModule mem_cache_module libexec/mod_mem_cache.so
LoadModule dbd_module libexec/mod_dbd.so
LoadModule dumpio_module libexec/mod_dumpio.so
LoadModule ext_filter_module libexec/mod_ext_filter.so
LoadModule include_module libexec/mod_include.so
LoadModule filter_module libexec/mod_filter.so
LoadModule deflate_module libexec/mod_deflate.so
LoadModule log_config_module libexec/mod_log_config.so
LoadModule log_forensic_module libexec/mod_log_forensic.so
LoadModule logio_module libexec/mod_logio.so
LoadModule env_module libexec/mod_env.so
LoadModule mime_magic_module libexec/mod_mime_magic.so
LoadModule cern_meta_module libexec/mod_cern_meta.so
LoadModule expires_module libexec/mod_expires.so
LoadModule headers_module libexec/mod_headers.so
LoadModule ident_module libexec/mod_ident.so
LoadModule usertrack_module libexec/mod_usertrack.so
LoadModule unique_id_module libexec/mod_unique_id.so
LoadModule setenvif_module libexec/mod_setenvif.so
LoadModule version_module libexec/mod_version.so
LoadModule proxy_module libexec/mod_proxy.so
LoadModule proxy_connect_module libexec/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/mod_proxy_http.so
LoadModule proxy_ajp_module libexec/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/mod_proxy_balancer.so
LoadModule ssl_module libexec/mod_ssl.so
LoadModule mime_module libexec/mod_mime.so
LoadModule dav_module libexec/mod_dav.so
LoadModule status_module libexec/mod_status.so
LoadModule autoindex_module libexec/mod_autoindex.so
LoadModule asis_module libexec/mod_asis.so
LoadModule info_module libexec/mod_info.so
LoadModule suexec_module libexec/mod_suexec.so
LoadModule cgi_module libexec/mod_cgi.so
LoadModule dav_fs_module libexec/mod_dav_fs.so
LoadModule vhost_alias_module libexec/mod_vhost_alias.so
LoadModule negotiation_module libexec/mod_negotiation.so
LoadModule dir_module libexec/mod_dir.so
LoadModule imagemap_module libexec/mod_imagemap.so
LoadModule actions_module libexec/mod_actions.so
LoadModule speling_module libexec/mod_speling.so
LoadModule userdir_module libexec/mod_userdir.so
LoadModule alias_module libexec/mod_alias.so
LoadModule rewrite_module libexec/mod_rewrite.so
<IfModule !mpm_netware_module>
User webservd
Group webservd
</IfModule>
ServerAdmin you@yourhost.com
ServerName 127.0.0.1
DocumentRoot "/var/apache2/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
<Directory "/var/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
ErrorLog /var/apache2/logs/error_log
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog /var/apache2/logs/access_log common
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/var/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
    TypesConfig /etc/apache2/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<IfModule prefork.c>
    ListenBacklog 8192
    ServerLimit 2048
    MaxClients 2048
</IfModule>

So, if we want to remove mod_dav module from the httpd.conf, we need to make sure
Dav, DavDepthInfinity, DavMinTimeout
are not mentioned in the httpd.conf file.

Labels: , , ,

Friday, June 01, 2007

Maths Olympics

Recently my daugther attended the Mathematics Olympics for Secondary 2. The questions are very tough if you have not been exposed to the type of questions before. One of the questions is pretty interesting.

Find the latest integer n so that n6021 < 20072007.

Not many people know how big is 20072007. If you use bc (arbitrary precision arithmetic language) to calculate it, it is a 6629 digit number.

So how can we approach this problem without having to deal with 6000+ digits.
6021 is 3 times of 2007, so we can express
n6021 as
n32007
Using the trail and error method, we can tabulate the result as:
n=10, n3=1000 < 2007
n=11, n3=1331 < 2007
n=12, n3=1728 < 2007
n=13, n3=2197 > 2007

So, the answer is 12

$ echo 2007^2007 | bc
16314605714687673100219161988221590518292210898740437841876506892750\
32306039423940369656182671626918374428665007728310641726207038681918\
23136702404167821902979921698186677089033622516321277953102421415380\
52881817063065329725414186570424721165880384220836219727730342712190\
37547038078493298854228413412450765335802752810679631982070064711707\
56994904826360657191473471275712342626409252812000487654952457462581\
25202397471862500575253203957986559953029179221497185241787894245109\
51506284252195025848010707100693306754335210537773553923807001377973\
58190841023173651478340362529204455978523734694649333587437048551880\
84344987860972778473042539830626220900910030243133077748096636794353\
16457852288885788183704321212603620156876288242227673033902489461859\
80807205983674431470103187228509985963442849376025881515659139204354\
57334048169514769124351395926915548900005107939870885748926502983652\
48220739239828923170534565961757683913268494073903341978940401041341\
24158904437217633744227156627420692310366588876904474906119640656336\
00909055629673774341172101831114453521702586164711667890001015971356\
60276401463142043929976624709724328792829957422043087537178795758647\
72185461767393859241999232092091753999161030318269214754924571963159\
35520624812251694955876845371629366273520636698693605424704420404631\
75277434551058391143650208928358475502339174967420269679902664658114\
23441325364666899042860424269755985756717730999047598611204004019487\
05037492513989337593522479668752257755675941902099185237554143748651\
76084285432698562312888918263670859517256741096260219051804661166619\
77156782563640767810527747055628531062056538632420611318856864435605\
98573568085436649055893711511908754786711917259735123805058932226875\
09020048745112007771764955307557550322001919379536452269156637570639\
67686895988403526418230539376546037003876670242151992373967447858965\
32371190719225599092102935960432876642206996867191908197903254065184\
66772118566829478154758078361829805339842140536877388530591895758845\
74615755305866464237994838787908227762252835497894144677604759903050\
56214887675010008762806122865755121275564759677904950783893207351021\
21793547077526595680554400368459226450944178849240467865779814317007\
96876505317193541397691960050013423154588306446442511274723228366073\
99740758368268646735204080379101950673539512645517752083915627087436\
66342779749004724047925157702126529475456581827940549061219833542771\
72666791641130825385603816826728793107694318470910676883660956902086\
59579147945702522853473552635534140382309303777950425443446724647072\
84039885465320015844579846408011500806127198942953456479287429126124\
58187025149566132957578262005878966556171671947012422179587596926224\
48413221909265362849341101538896719374297181506945626681830899361082\
17588258048154216467741811634089431627204908200906712352236452851164\
60870051555430826004956456747145900922832888740550701604291930516794\
53804271088240995714495287536761378107585304471702025690381237435699\
62867717292953981124669065011683502890758991080085205157633970212891\
98777309368701179857410923501969865110478773653903699197912297908533\
71149722723292678177205635678230292598408904569266566529096965940687\
19800187410667900893753388917161120090709121225671327994837556358866\
13795364895358454179682944936819599409259644069296990066176672218326\
10569446092009445906651399279429326070744029719496103157306940293382\
08652605749532755522690122699195850782355410608547470555886945614660\
28849763565012828241503887371454415825187174123047124428965559186350\
65661067953888197801888330944283778895151118014938632162825657485422\
26873379147497009487850977528543889031689799484755702907033188341688\
57086162026884996378694574719417715017198218671864779969442373083947\
84224584936854774880083798459580587181441861962025043001696668942099\
98369361531152251402670787887047071049415711093008135194582239773277\
57730018467737893821357739016393737981517063929164948629278989863490\
66462204249411800881288288291970583303627128619570872408141516094456\
83837112137017595507346794006856000647005501898922929846153939218796\
28234593579234420657377664780055273852674449396670561737910057331770\
53405452811154572480773839659370346376909955589954534463995402397547\
55090554901741064115038670213867607618630149352412903118245252687275\
28109561678498436676798923797165313359732911821400623859409924152069\
06300260638828041177167702847188712306493492372142866618404908913176\
54030952366549559176082480786655059388809520507182637615683247714988\
05191492633132029599544921486661970299947588786678189871088966477407\
52512996563850623228109536022666509972476172556459154412193755524859\
28452331588277656632220424016664113248809498813370962561820162791582\
64121448823383689967724103592671517706815568744426523608840138911714\
53958944518234290650299585576981492919941107102609478933946462619302\
48865632368726622732906937659050660925986430541337820914319653668221\
87349651540078364469161738550494782857953599406614823850511779698786\
91838865273359122035277482634624991021675924624312254360293884842917\
65838307747253780974059548132381415125202990686958323920598730920623\
83252041705054542282692895103797418414876506955754092950593171511526\
03651256685226830058555083998194070710847307757088197896172035753443\
57325024752384875269065693702994828638438768496534182574105672247872\
16889073273120095695064749134557169837596440817787277202590296656949\
48573652672557136771335615479698964295228224311865290533314649278929\
66378562879105977303922021842036171103420525191259589291180958162828\
53849025184090592088836475653212594663891594930011800278301810320167\
71271739342026383819163505909340986688942636949341034442899607560777\
48743959210409197647213006839217933959866202483201890809519278801288\
89774489640070710220962719764159839606000869526896455498122625138520\
03473593771023384202960841337266822055244894318115626747268831051684\
93368590796032830924999538553468389382057082607007101680887865179417\
56230281766141812283600778826785130821021267795745725254521386017285\
26298885351305296325067178476137349370135741313308883039679816779268\
89819182812687810885966489071842746337245202749132624149354170939165\
16259303899012457012515608202326844412337496478945032118391923014778\
60791546940874717049537071793531373218290246791145310292221059372892\
64816915738818462542773732790559090793017150142535888474230492964601\
87531820919736515493904236213757675608136303680989586717189185046309\
78276773061725084597786832034498958720078262844355265962017842479132\
62269519023741579612330789171572662737099118044136909873639373744006\
57859538070736932317321882339952581950548422144343493289702293960474\
93455994166543113414231137214737093262742407103151085798658468378983\
026266371632383860581109563509543
To count how many digit there, we need to get rid of the backslash and the newline
$ echo 2007^2007 | bc | sed -e 's/\\//' | awk '{printf("%s",$1)}' | wc -c
6629

Labels: ,