短暂存储或EBS中的php-fpm Unix Socket更好吗?

时间:2014-08-07 22:02:32

标签: linux nginx amazon-ec2 php

我试图调整我的EC2表现。其中之一是将短暂存储用于所有I / O.对于php-fpm,我使用unix socket而不是tcp / ip,因为一切都是本地的。考虑到EBS存储只有24 IOPS(8GB),我想知道将php-fpm套接字移动到临时存储是否更好。 unix套接字文件中是否有任何I / O活动,因为文件大小始终为0

[root@ php-fpm]# ls -al
total 12
drwxr-xr-x  2 root  root  4096 Aug  5 19:37 .
drwxr-xr-x 16 root  root  4096 Aug  7 03:27 ..
-rw-r--r--  1 root  root     4 Aug  5 19:37 php-fpm.pid
srw-rw-rw-  1 nginx nginx    0 Aug  5 19:37 php-fpm.sock

1 个答案:

答案 0 :(得分:1)

EBS是一种基于网络的服务,因此每一项操作都依赖于网络。 The docs说:

An Amazon EBS volume is off-instance storage that can persist independently from the life of an instance. 

考虑套接字的临时存储。如果您使用EBS,请不要忘记在首次使用之前使用磁盘重叠分配所有磁盘:

dd if=/dev/zero of=/dev/xvdf bs=1M

但是如果您愿意使用它,请不要在根/磁盘上执行此操作,只需在额外的EBS磁盘上执行。

P.S。如何预热EBS,请阅读official docs

中的所有详细信息