apache2.2+Tomcat+jk 集群

是二子啊 2013-08-22 04:32:21

单个Tomcat6.0 测试并发数500通过。
用Apache做了集群。并发果断降到100.应该是配置出问题。我想知道配置哪里出问题了。
在线等。。。
求大神指点~~~~~~~~~~~~~~


环境:
Win7 64位 8G内存,4核i5处理器。Mysql5.6,项目SSH2


配置:
httpd-mpm.conf


#
# Server-Pool Management (MPM specific)
#

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#
<IfModule !mpm_netware_module>
PidFile "logs/httpd.pid"
</IfModule>

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile "logs/accept.lock"
</IfModule>
</IfModule>

#
# Only one of the below sections will be relevant on your
# installed httpd. Use "apachectl -l" to find out the
# active mpm.
#

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
# ServerLimit 10000
# StartServers 750
# MinSpareServers 20
# MaxSpareServers 1000
# MaxClients 10000
# MaxRequestsPerChild 50000
# ServerLimit 4000
# StartServers 5
# MinSpareServers 5
# MaxSpareServers 10
# MaxClients 4000
# MaxRequestsPerChild 10000
<IfModule mpm_prefork_module>
ServerLimit 10000
StartServers 750
MinSpareServers 20
MaxSpareServers 1000
MaxClients 10000
MaxRequestsPerChild 50000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
# StartServers 2
# MaxClients 150
# MinSpareThreads 25
# MaxSpareThreads 75
# ThreadsPerChild 25
# MaxRequestsPerChild 0
<IfModule mpm_worker_module>
StartServers 5
ServerLimit 20
ThreadLimit 200
MaxClients 4000
MinSpareThreads 25
MaxSpareThreads 250
ThreadsPerChild 200
MaxRequestsPerChild 0
</IfModule>

# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients: max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule mpm_beos_module>
StartThreads 10
MaxClients 50
MaxRequestsPerThread 10000
</IfModule>

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximum number of requests a thread serves. It is
# recommended that the default value of 0 be set for this
# directive on NetWare. This will allow the thread to
# continue to service requests indefinitely.
<IfModule mpm_netware_module>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxRequestsPerChild 5
MaxMemFree 100
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
# to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpm_mpmt_os2_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxRequestsPerChild 0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150
MaxRequestsPerChild 0
</IfModule>




workers.properties


#下面是Tomcat实例列表
worker.list=tomcatbbs

#Tomcat1实例配置 这里要和Tomcat配置文件Service.xml的jvmRoute保持一致
worker.tomcat1.host=localhost
worker.tomcat1.port=7009
worker.tomcat1.type=ajp13
#分发权重 值越大负载越大
worker.tomcat1.lbfactor = 1
worker.tomcat1.socket_timeout=10#配置超时时间
worker.tomcat1.connection_pool_timeout=600#配置关闭空闲连接时间


#Tomcat2实例配置
worker.tomcat2.host=localhost
worker.tomcat2.port=8009
worker.tomcat2.type=ajp13
#分发权重 值越大负载越大
worker.tomcat2.lbfactor = 1
worker.tomcat2.socket_timeout=10#配置超时时间
worker.tomcat2.connection_pool_timeout=600#配置关闭空闲连接时间



#负载均衡分发控制器
worker.tomcatbbs.type=lb
worker.tomcatbbs.balance_workers=tomcat1,tomcat2

worker.tomcatbbs.sticky_session=false

...全文
209 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
MiceRice 2013-08-23
  • 打赏
  • 举报
回复
加Q群吧。。。 229609257
是二子啊 2013-08-23
  • 打赏
  • 举报
回复
引用 4 楼 ldh911 的回复:
Windows 操作系统 使用的是 mpm_winnt,你所做的测试,毫无意义。 Linux下,要检查下你编译Apache时,选择的是 mpm_prefork 还是 mpm_worker,一般推荐后者。 —— 注:这个信息可以直接从 http://localhost/server-info 中看到,如果你开启了的话
能加下QQ说吗?1987870278 谢谢啦~
MiceRice 2013-08-23
  • 打赏
  • 举报
回复
Windows 操作系统 使用的是 mpm_winnt,你所做的测试,毫无意义。 Linux下,要检查下你编译Apache时,选择的是 mpm_prefork 还是 mpm_worker,一般推荐后者。 —— 注:这个信息可以直接从 http://localhost/server-info 中看到,如果你开启了的话
是二子啊 2013-08-23
  • 打赏
  • 举报
回复
引用 1 楼 ldh911 的回复:
问题:什么操作系统? 建议:开启server-status和server-info检查配置情况和运行情况 <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 管理机IP </Location> <Location /server-info> SetHandler server-info Order deny,allow Deny from all Allow from 管理机IP </Location>
服务器是Linux 64位 我拿本机测试的,本机是Win7
jongsuny 2013-08-22
  • 打赏
  • 举报
回复
如果是单纯的用jk连接tomcat的话可以考虑下面的配置: <IfModule mpm_prefork_module> ServerLimit 2048 StartServers 128 MinSpareServers 128 MaxSpareServers 256 MaxClients 2048 MaxRequestsPerChild 0 </IfModule> apache的httpd.conf配置
MiceRice 2013-08-22
  • 打赏
  • 举报
回复
问题:什么操作系统? 建议:开启server-status和server-info检查配置情况和运行情况 <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 管理机IP </Location> <Location /server-info> SetHandler server-info Order deny,allow Deny from all Allow from 管理机IP </Location>

25,980

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧