1

我有这样的问题:当负载增加到每秒 200 个脚本查询时,phpcassa 会导致这样的异常

Error connecting to localhost:9160: TException: TSocket: Could not connect to localhost:9160 (Cannot assign requested address [99])
Error connecting to localhost:9160: TException: TSocket: Could not connect to localhost:9160 (Cannot assign requested address [99])
PHP Fatal error:  Uncaught exception 'NoServerAvailable' with message 'An attempt was made to connect to every server twice, but all attempts failed. The last error was: TException:TSocket: Could not connect to localhost:9160 (Cannot assign requested address [99])' in /var/www/megaumnik/context/connection.php:232
Stack trace:
#0 /var/www/megaumnik/context/connection.php(257): ConnectionPool->make_conn()
#1 /var/www/megaumnik/context/connection.php(351): ConnectionPool->get()
#2 /var/www/megaumnik/context/connection.php(286): ConnectionPool->call('describe_keyspa...', 'thegame')
#3 /var/www/megaumnik/context/columnfamily.php(194): ConnectionPool->describe_keyspace()
#4 /var/www/megaumnik/data/getData.class.php(265): ColumnFamily->__construct(Object(ConnectionPool), 'username')
#5 /var/www/megaumnik/data/test.php(6): getData->getDataByKey('username', '317')
#6 {main}
  thrown in /var/www/megaumnik/context/connection.php on line 232

脚本有 4 个来自不同列族的 $cf->get()。每个列族有 1000 行

4

1 回答 1

1

It sounds like maybe you are hitting the open file limit. You can see what the current limit is with 'ulimit -a'.

To increase the limit, you can set a new limit in one of two ways. First, you can do something like 'ulimit -n 10000', which is temporary, and will only affect processes started by that shell. To permanently increase the limit, you need to add a line to /etc/security/limits.conf that looks like this:

*               -       nofile      10000

For this to take effect, I believe you need to log in again.

于 2011-12-02T06:33:19.593 回答