ENV:
1,php 5.5
2,mongodb 2.4.6 with replSet(一个主要和五个次要)
3,pecl-mongo 1.5.44,带有readPreference的php数据库配置:
array(
'database' => 'mydatabase',
'server' => 'mongodb://mongo1:27017,mongo2:27017,mongo3:27017,mongo4:27017,mongo5:27017,mongo6:27017/?readPreference=secondary',
'options' => array('replicaSet' => 'myreplica'),
'profiling' => FALSE,
),
5,mongostats:
mognodb primary (mongostats): 5000-20000 command 10-50 update
mongodb secondary (mongostats): 1000-1800 command 1000-4000 query
我发现主节点负载很高然后我发现很多系统调用(克隆)与strace -c -p 如何减少系统调用(克隆)?
# strace -c -p 3004
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
53.80 0.020932 6 3687 clone
13.80 0.005368 1 7374 getsockopt
13.15 0.005116 1 7374 setsockopt
7.90 0.003072 1 3688 select
6.13 0.002385 1 3687 getrlimit
5.23 0.002033 1 3687 accept
0.00 0.000000 0 111 mmap
0.00 0.000000 0 111 mprotect
0.00 0.000000 0 14 6 futex
------ ----------- ----------- --------- --------- ----------------
100.00 0.038906 29733 6 total