从EC2上的NFS文件服务器读取Apache 2性能

我试图设置一个ELB和4 EC2 m1.large的环境,从另一台EC2 m1.small NFS v3服务器上运行Apache 2。

我使用Apache Benchmark来测量每秒请求的性能,使用以下命令:

ab -k -n100 -c1 http://localhost/index.html 

我使用-o noatime,_netdev装入NFS共享

实例在N.California。

west-1a有2个Web服务器和NFS服务器。 west-1c有2个Web服务器。

每当我运行ab从本地EBS卷读取文件,我得到一致的结果,但是当我从NFS共享读取运行时,结果变化超过100%,当我顺序执行testing:

 for i in $(seq 100); do ab -k -n 100 -c 1 http://localhost/index.html | grep -i "requests per second" ; done 

示例输出:

 Requests per second: 0.36 [#/sec] (mean) Requests per second: 2.39 [#/sec] (mean) Requests per second: 117.12 [#/sec] (mean) Requests per second: 128.13 [#/sec] (mean) Requests per second: 349.67 [#/sec] (mean) Requests per second: 161.31 [#/sec] (mean) Requests per second: 87.54 [#/sec] (mean) Requests per second: 132.84 [#/sec] (mean) Requests per second: 226.37 [#/sec] (mean) Requests per second: 258.42 [#/sec] (mean) Requests per second: 258.02 [#/sec] (mean) Requests per second: 272.02 [#/sec] (mean) Requests per second: 211.56 [#/sec] (mean) Requests per second: 180.66 [#/sec] (mean) Requests per second: 209.89 [#/sec] (mean) Requests per second: 0.37 [#/sec] (mean) Requests per second: 20.62 [#/sec] (mean) Requests per second: 38.24 [#/sec] (mean) Requests per second: 37.95 [#/sec] (mean) Requests per second: 91.70 [#/sec] (mean) Requests per second: 119.31 [#/sec] (mean) Requests per second: 112.17 [#/sec] (mean) Requests per second: 118.26 [#/sec] (mean) Requests per second: 119.06 [#/sec] (mean) Requests per second: 69.67 [#/sec] (mean) Requests per second: 117.91 [#/sec] (mean) Requests per second: 118.93 [#/sec] (mean) Requests per second: 119.10 [#/sec] (mean) Requests per second: 120.92 [#/sec] (mean) Requests per second: 121.33 [#/sec] (mean) Requests per second: 1.42 [#/sec] (mean) Requests per second: 106.74 [#/sec] (mean) Requests per second: 401.16 [#/sec] (mean) Requests per second: 404.73 [#/sec] (mean) Requests per second: 406.82 [#/sec] (mean) Requests per second: 417.38 [#/sec] (mean) Requests per second: 412.92 [#/sec] (mean) Requests per second: 420.86 [#/sec] (mean) Requests per second: 419.59 [#/sec] (mean) Requests per second: 415.37 [#/sec] (mean) Requests per second: 388.77 [#/sec] (mean) Requests per second: 413.89 [#/sec] (mean) Requests per second: 409.92 [#/sec] (mean) Requests per second: 416.84 [#/sec] (mean) Requests per second: 11.53 [#/sec] (mean) Requests per second: 38.46 [#/sec] (mean) Requests per second: 70.85 [#/sec] (mean) Requests per second: 71.28 [#/sec] (mean) Requests per second: 60.33 [#/sec] (mean) Requests per second: 55.83 [#/sec] (mean) Requests per second: 41.74 [#/sec] (mean) Requests per second: 46.33 [#/sec] (mean) Requests per second: 75.05 [#/sec] (mean) Requests per second: 95.06 [#/sec] (mean) Requests per second: 96.73 [#/sec] (mean) Requests per second: 97.15 [#/sec] (mean) Requests per second: 96.70 [#/sec] (mean) Requests per second: 57.88 [#/sec] (mean) 

我的问题是:这可能与AWSnetworking有关,是否有任何调整可以获得更一致的结果? 我把NFS服务器移到其他AZ上,并没有改变不一致的因素。

PS:这发生在所有networking服务器上。

所以关于亚马逊的networking存储有很多移动部件。 所以不得不把这个问题分解成几个部分。 你可能想看看iSCSI作为NFS的替代品,因为它被称为有这样的事情的问题,但我会尽我所能来帮助。

所以第一件事是如果你使用一个elb作为这个NFS服务器实例,那么它已经是networking存储了。 我将以另一种方式再次说出您的networking存储具有networking存储。 为了使事情更加复杂,每个AWS根据实例的大小分割networking(以及从networking开始的stream量),所以对于M1小型networking,您将获得非常less量的networking性能,并将其标记为“ 低 ”

现在接下来的事情是你必须跟踪的是每台M1.large机器上的caching。 由于它不是本地磁盘服务器不知道,如果该驱动器上的文件,所以它不会caching在本地计算机上的内存中的文件,所以每个Web请求发送到m1.small并获取数据,这需要时间,你可能想要启用caching,但你的里程可能与代码部署。

我build议你看看最后一件事是检查你的Apache设置,看看你是否能做得更好,“ 25个Apache性能调优技巧 ”,也许玩MPM worker和MPM prefork

PS目前你的m1.small有1.7gb的内存,所以只要留意它会尝试caching来自磁盘的内存项目我不确定你的网站有多大,但要记住的东西。

我猜测你把“-c”设置为1的原因是因为你在双核服务器上运行它,尝试在另一台机器上运行它,并尝试将其设置为10或更大的数字,如果这不起作用把它放在一个ELB下面,然后拿到另外一台机器,打开很multithreading,elb上只有一个热身期