Exception when I make more than 1000 connections to the nettey server
Trustin Lee (이희승)
trustin at gmail.com
Tue Nov 3 04:02:24 EST 2009
http://n2.nabble.com/Error-netty-Connection-Server-tp2297129p2306957.html
— Trustin Lee, http://gleamynode.net/
On Mon, Nov 2, 2009 at 9:55 PM, srikanthlives <srikanthlives at gmail.com> wrote:
>
> Hi,
>
> Does any one need any other further inputs to help me, please let me know. I
> am really struck with this.
>
> Thanks,
> Srikanth
>
>
> srikanthlives wrote:
>>
>> Hi,
>>
>> I am new user to Netty. I have took Netty and wrote a simple discard
>> server over Netty. I tried connecting to Netty from a flooding client
>> which make several connections to the server. I started with 100
>> connections and it worked well. than increased it to 1000 connections it
>> increased well. Finally I increased it to 2000 connections and the server
>> trowed an exception.
>>
>> Server Operating System is : RedHat Linux enterprise 4.
>>
>> I configured the server settings according to the article
>> http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1
>>
>> below are the settings taken from the above url
>> =====================================
>> # General gigabit tuning:
>> net.core.rmem_max = 16777216
>> net.core.wmem_max = 16777216
>> net.ipv4.tcp_rmem = 4096 87380 16777216
>> net.ipv4.tcp_wmem = 4096 65536 16777216
>> net.ipv4.tcp_syncookies = 1
>> # this gives the kernel more memory for tcp
>> # which you need with many (100k+) open socket connections
>> net.ipv4.tcp_mem = 50576 64768 98152
>> net.core.netdev_max_backlog = 2500
>> # I was also masquerading the port comet was on, you might not need this
>> net.ipv4.netfilter.ip_conntrack_max = 1048576
>>
>> Put these in /etc/sysctl.conf then run sysctl -p to apply them. No need to
>> reboot, now your kernel should be able to handle a lot more open
>> connections, yay.
>> ==============================================================
>>
>> ==============================================================
>> Each connection we make requires an ephemeral port, and thus a file
>> descriptor, and by default this is limited to 1024. To avoid the Too many
>> open files problem you’ll need to modify the ulimit for your shell. This
>> can be changed in /etc/security/limits.conf, but requires a logout/login.
>> For now you can just sudo and modify the current shell (su back to your
>> non-priv’ed user after calling ulimit if you don’t want to run as root):
>>
>> $ sudo bash
>> # ulimit -n 999999
>> # erl
>>
>> You might as well increase the ephemeral port range to the maximum too:
>> # echo "1024 65535" > /proc/sys/net/ipv4/ip_local_port_range
>> =============================================
>>
>>
>> First it was throwing too many connections exception at OS level and I
>> increased the "ulimt" on linux to 999999
>>
>> Now its throwing a different exception
>> =============================
>> ZoneInfo: /usr/java/jdk1.6.0_16/jre/lib/zi/ZoneInfoMappings (Too many open
>> files)
>> ZoneInfo: /usr/java/jdk1.6.0_16/jre/lib/zi/ZoneInfoMappings (Too many open
>> files)
>> Exception in thread "pool-1-thread-1" java.lang.InternalError
>> at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:752)
>> at sun.misc.URLClassPath.getResource(URLClassPath.java:168)
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:192)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>> at
>> java.util.ResourceBundle$RBClassLoader.loadClass(ResourceBundle.java:445)
>> at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2383)
>> at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1406)
>> at java.util.ResourceBundle.findBundle(ResourceBundle.java:1365)
>> at java.util.ResourceBundle.findBundle(ResourceBundle.java:1292)
>> at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1234)
>> at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
>> at java.util.logging.Level.getLocalizedName(Level.java:223)
>> at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:64)
>> at java.util.logging.StreamHandler.publish(StreamHandler.java:179)
>> at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:88)
>> at java.util.logging.Logger.log(Logger.java:458)
>> at java.util.logging.Logger.doLog(Logger.java:480)
>> at java.util.logging.Logger.logp(Logger.java:680)
>> at org.jboss.netty.logging.JdkLogger.warn(JdkLogger.java:86)
>> at
>> org.jboss.netty.logging.InternalLoggerFactory$1.warn(InternalLoggerFactory.java:133)
>> at
>> org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:242)
>> at
>> org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
>> at
>> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.util.zip.ZipException: error in opening zip file
>> at java.util.zip.ZipFile.open(Native Method)
>> at java.util.zip.ZipFile.<init>(ZipFile.java:114)
>> at java.util.jar.JarFile.<init>(JarFile.java:133)
>> at java.util.jar.JarFile.<init>(JarFile.java:70)
>> at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:643)
>> at sun.misc.URLClassPath$JarLoader.access$600(URLClassPath.java:538)
>> at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:605)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:597)
>> at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:750)
>> ... 31 more
>>
>>
>> Can some one help?
>>
>> FYI: I am running the program from discard server from eclipse.
>>
>> Regards,
>> Srikanth
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Exception-when-I-make-more-than-1000-connections-to-the-nettey-server-tp3917846p3931623.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
More information about the netty-users
mailing list