yes, if the number of sockets not continues to grow unbounded,it's not a problem. the env of the client has set to 60000(ulimit -HSn 60000),is this value enough?
在2015年12月22 06时34分, "Christopher"<[email protected]>写道: I could see a concern if the number of sockets continues to grow unbounded, but if it levels off at some point, and the surge is only temporary, it might be better to just make sure you bump up your system's security limits for the number of open files ("nofile" in /etc/security/limits.{d/|conf}. This is something the Accumulo project has been recommending, and I've heard similar recommendations from Hadoop users, and other cloud and/or bigdata systems. The defaults in many systems are just too small to handle routine use cases. On Sun, Dec 20, 2015 at 3:58 PM wsk-528 <[email protected]> wrote: > hello: > accidentally,i find a problem than the zookeeper client print "too > many open files" with server version 3.4.6, and i use the same java client > version. > the env is like this:the server running on server A, and the client > running on server B(RHEL AS5), when i pull out the cable between them, the > client print "too many open files" ,and network unreachable. > i test if i shutdown the network interface,the same log was printed. > i use lsof -p <pid>,i can see a lot of socket file handle. > > > > > my code is as following: > public class ZKTest { > > > /** > * @param args > * @throws IOException > * @throws InterruptedException > * @throws KeeperException > */ > public static void main(String[] args) throws IOException, > InterruptedException, KeeperException { > ZooKeeper zk = new ZooKeeper(args[0], 30000, new Watcher() { > > > @Override > public void process(WatchedEvent event) { > if(event.getState()==KeeperState.SyncConnected) { > System.out.println("connected..."); > } else if(event.getState()==KeeperState.Disconnected) { > System.out.println("disconnected..."); > } else if(event.getState()==KeeperState.Expired) { > System.out.println("expired..."); > } else { > System.out.println("unknow " + event.getState()); > } > } > }); > zk.exists("/testpath", false); > Object o = new Object(); > synchronized(o) { > o.wait(); > } > } > > > } > > > >
