7.1. 压测环境
7.1.1. 压测平台
压测发起端为台机PC(192.168.6.17),配置如下:
CPU : Intel Core i3-3240 3.40GHz 3.40GHz内存 : 512MBWindowsXP里面装了VMWARE 10里面装了RedHat Enterprise Linux Server release 5.4 ( 32BITS )
压测网络为百兆有线
压测服务端为台机PC(192.168.6.111),配置如下:
CPU : AMD E-350 1.60GHz 1.60GHz内存 : 4GBRedHat Enterprise Linux Server release 5.4 ( 32BITS )
7.1.2. 压测客户端
压测客户端采用Apache自带工具ab。
因ab只支持HTTP/1.0而不支持HTTP/1.1,会引发Nginx的压缩和Keep-Alive不能同时开启的BUG,故修改了ab.c中填充HTTP请求版本的代码,重新编译成ab2供压测使用。hetao和Apache则不受影响。
httpd-2.2.17/support/ab.c
- 1609 /* setup request */
- 1610 if (posting <= 0) {
- 1611 snprintf_res = apr_snprintf(request, sizeof(_request),
- 1612 "%s %s HTTP/1.1\r\n"
- 1613 "%s" "%s" "%s"
- 1614 "%s" "\r\n",
- 1615 (posting == 0) ? "GET" : "HEAD",
- 1616 (isproxy) ? fullurl : path,
- 1617 keepalive ? "Connection: Keep-Alive\r\n" : "",
- 1618 cookie, auth, hdrs);
- 1619 }
- 1620 else {
- 1621 snprintf_res = apr_snprintf(request, sizeof(_request),
- 1622 "%s %s HTTP/1.1\r\n"
- 1623 "%s" "%s" "%s"
- 1624 "Content-length: %" APR_SIZE_T_FMT "\r\n"
- 1625 "Content-type: %s\r\n"
- 1626 "%s"
- 1627 "\r\n",
- 1628 (posting == 1) ? "POST" : "PUT",
- 1629 (isproxy) ? fullurl : path,
- 1630 keepalive ? "Connection: Keep-Alive\r\n" : "",
- 1631 cookie, auth,
- 1632 postlen,
- 1633 (content_type[0]) ? content_type : "text/plain", hdrs);
- 1634 }
7.1.3. 压测服务端
选用以下Web服务器软件做横向压测,版本和配置侦听端口如下:
hetao/0.2.0 && hetao/0.7.0,侦听端口为9527Nginx/1.9.13,侦听端口为9528Apache/2.2.14,侦听端口为9529Tengine/2.1.2,侦听端口为9530
(原计划还有kangle/3.4.8,但是从官网上下载的源代码编译安装始终报错,猜可能是我的Linux编译器gcc版本过低,不支持_sync原子操作,但rhel5.4也不低啊,算了,不用它了)
- ...
- g++ -I../module/access -I../module/whm -O2 -g -DNDEBUG -D_REENTRANT -DLINUX -D_LARGE_FILE -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -L../lib -o kangle cache.o KConfig.o forwin32.o garbage_c.o HttpCore.o KAccess.o KAcserver.o KAcserverManager.o KBuffer.o KChain.o KConfigBuilder.o KConfigParser.o KContentType.o KDiskCache.o KPortSelector.o KKqueueSelector.o KEpollSelector.o KFastcgiFetchObject.o KFastcgiUtils.o KFetchObject.o KFileMsg.o KFileName.o KHtmlSupport.o KHtmlSupportException.o KHttpKeyValue.o KHttpManage.o KHttpObject.o KHttpObjectHash.o KHttpObjectParserHook.o KHttpProtocolParser.o KHttpProtocolParserHook.o KHttpProxyFetchObject.o KHttpRequest.o KHttpServerParser.o KLang.o KLangParser.o KLogElement.o KReg.o KSelector.o KSelectorManager.o KSequence.o KServerListen.o KSocket.o KSocketFetchObject.o KTable.o KThreadPool.o KTimeMatch.o KUrlValue.o KVirtualHost.o KVirtualHostManage.o KWriteBack.o KWriteBackManager.o KXmlContext.o KXml.o KXmlException.o KXmlSupport.o lib.o log.o main.o malloc_debug.o md5.o work.o utils.o KAccessParser.o KString.o KRewriteMark.o KSingleProgram.o KHttpTransfer.o KDeChunked.o KGzip.o KServer.o KSelectable.o KStream.o KNsVirtualHost.o KContentMark.o KRedirectMark.o KLineFile.o KMultiHostAcl.o test.o KHttpFieldValue.o KSingleAcserver.o KMultiAcserver.o KSockPoolHelper.o KEnvInterface.o KRedirect.o KCgiRedirect.o KCgiFetchObject.o KPipeStream.o KCgi.o KCgiEnv.o KApiRedirect.o KApiEnv.o HttpExt.o KApiFetchObject.o KHttpHeadPull.o KSockFastcgiFetchObject.o KApiFastcgiFetchObject.o KPathRedirect.o KLogManage.o KBaseVirtualHost.o process.o KContentTransfer.o KChunked.o KCacheStream.o KHttpField.o KHttpDigestAuth.o KHttpAuth.o KHttpBasicAuth.o KAuthMark.o KObjectList.o KAjpMessage.o KAjpFetchObject.o KExpressionParseTree.o KSSICommandCondition.o KSSICommandEcho.o KSSICommandInclude.o KSSIContext.o KSSIRedirect.o KSSICommandSet.o KSSIProcess.o KSSICommand.o KSSICommandPrintEnv.o KSSIFetchObject.o KServiceProvider.o KISAPIServiceProvider.o directory.o KSSICommandExec.o KSSICommandConfig.o ssl_utils.o KApiPipeStream.o KPoolableSocketContainer.o KProcessManage.o KCmdPoolableRedirect.o KSubVirtualHost.o KIpVirtualHost.o KHttpPost.o KHtAccess.o KHtModule.o KHtRewriteModule.o KRewriteMarkEx.o EdcodeUtils.o KProcess.o KApiProcess.o KCmdProcess.o KVirtualHostProcess.o KExtendProgram.o KDynamicString.o kmysql.o KCdnMysqlMark.o KCdnRewriteMark.o KCdnContainer.o KTempleteVirtualHost.o KVirtualHostDatabase.o KDsoModule.o KList.o KListNode.o KLogHandle.o KRequestQueue.o KContext.o KCdnRedirect.o time_utils.o rbtree.o KVirtualHostContainer.o KSocketBuffer.o KAsyncFetchObject.o KSyncFetchObject.o KStaticFetchObject.o KDirectoryFetchObject.o KApiDso.o KUwsgiFetchObject.o KScgiFetchObject.o KHmuxFetchObject.o KTempFile.o KListenConfigParser.o KApacheVirtualHost.o KSSLSocket.o KAsyncWorker.o KInputFilter.o KMultiPartInputFilter.o KReplaceContentMark.o KReplaceContentFilter.o KConcatFetchObject.o KIpSpeedLimitMark.o KDynamicListen.o KCache.o KPerIpAcl.o KDiskCacheIndex.o KSqliteDiskCacheIndex.o ../module/whm/dllmain.o ../module/whm/WhmCallMap.o ../module/whm/WhmCommand.o ../module/whm/WhmContext.o ../module/whm/whm.o ../module/whm/WhmLog.o ../module/whm/WhmPackage.o ../module/whm/WhmPackageManage.o ../module/whm/KWhmService.o ../module/whm/stdafx.o ../module/whm/WhmDso.o ../module/whm/WhmExtend.o ../module/whm/WhmUrl.o ../module/whm/WhmShell.o ../module/whm/WhmShellProcess.o ../module/whm/WhmShellSession.o ../module/whm/whmdso/core/core.o KTimer.o KUrlParser.o KHttpFilterContext.o KHttpFilterDso.o KHttpFilterDsoManage.o KHttpFilterHookCollectRequest.o KHttpFilterHook.o KHttpFilterManage.o KTempFileStream.o KHttpFilterStream.o KHttpFilterHookCollectResponse.o KAccessDso.o KConnectionSelectable.o KReadWriteBuffer.o KResponseContext.o KUpstreamSelectable.o KSimulateRequest.o KCloudIpAcl.o -lpthread -lpcre -lz -ldl
- KConfig.o: In function `katom_cas':
- /home/calvin/expack/kangle-3.4.8/src/katom.h:107: undefined reference to `__sync_bool_compare_and_swap_4'
- KConfig.o: In function `katom_inc':
- /home/calvin/expack/kangle-3.4.8/src/katom.h:39: undefined reference to `__sync_add_and_fetch_4'
- HttpCore.o: In function `katom_inc':
- /home/calvin/expack/kangle-3.4.8/src/katom.h:39: undefined reference to `__sync_add_and_fetch_4'
- HttpCore.o: In function `katom_dec':
- /home/calvin/expack/kangle-3.4.8/src/katom.h:49: undefined reference to `__sync_add_and_fetch_4'
- HttpCore.o: In function `katom_dec':
- /home/calvin/expack/kangle-3.4.8/src/KHttpRequest.h:353: undefined reference to `__sync_add_and_fetch_4'
- HttpCore.o: In function `katom_inc':
- /home/calvin/expack/kangle-3.4.8/src/katom.h:39: undefined reference to `__sync_add_and_fetch_4'
- HttpCore.o:/home/calvin/expack/kangle-3.4.8/src/katom.h:49: more undefined references to `__sync_add_and_fetch_4' follow
- ...