• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why ConnectException throwed  RSS feed

 
Light Wan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
My rmi implementation is described as following. There is a rmi factory at the server side. When a client wants to access the server data, the rmi factory returns a new rmi Data object for this client. Then, every client has its own rmi Data object. I started a testcase to test server: firstly, created 200 rmi client, then every client tried to create a new record in database, and each action(create a new record) was encapsulated in a single thread. At first, my rmi server works very well. But, if I run the testcase over and over again. Then the ConnectException was throwed. The stack trace is listed below. My question is why ConnectExceptions did not been throwed at first, but throwed after I ran the testcase over and over again.

I don't know how about the under truth of rmi. Could you please help me?
Best Regards,
Light
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like a lot of clients. Are you trying to run them all at the same time? What OS is your server running on? Any chance you are getting bounced because you are trying to open too many connections? Even if you stop your program and then restart, do you somehow disconnect gracefully, or do you leave the server hanging thinking you are still there? I don't know how all that is handled, but with massive amounts of clients, I could see something like that happening if the server never knew anyone was dropping out and you just kept adding more connections. Does it work again if you restart the server and then reconnect your clients?
Chris
 
Light Wan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,
That sounds like a lot of clients.

I also think the reason is too many clients. Because I ran the testcase over and over. The rmi server maybe have no time to run the Garbage Collector. I don't know about how many clients can connect to rmi server at the same time.
Are you trying to run them all at the same time?

Yes. I modified my testcase to created 2000 rmi clients. The process of creating these clients did not throw any exception. But after I called the 2000 threads to start, then connect exceptions were throwed in the running process of some threads, not all threads.
What OS is your server running on?

My server ran on Win2000 professional OS.
Any chance you are getting bounced because you are trying to open too many connections? Even if you stop your program and then restart, do you somehow disconnect gracefully, or do you leave the server hanging thinking you are still there? I don't know how all that is handled, but with massive amounts of clients, I could see something like that happening if the server never knew anyone was dropping out and you just kept adding more connections. Does it work again if you restart the server and then reconnect your clients?

Maybe, the rmi server needs more memory. I restart the server after connect exceptions were throwed, then I ran the testcase. Connect exceptions was also throwed in the running process of some threads. But, if I ran my gui client, gui client worked well and no problem. I don't know why rmi server canot response to some clients when so many clients called rmi method simultaneously.
Best Regards,
Light
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But after I called the 2000 threads to start, then connect exceptions were throwed in the running process of some threads, not all threads.

What kind of delay time did you leave between each client trying to connect? If you tried to slam them all into place as fast as you could, I can see the server not being able to keep up with the client connection requests. try it with a 3 second delay or something between each one.
Maybe, the rmi server needs more memory.

I don't think this is an issue. The java error will say if it is out of memory.
But, if I ran my gui client, gui client worked well and no problem.
If this is the method you see your program working in, then slamming it full of 2000 clients isn't a good simulation of its capabilities. Is this for a business environment where people would be hoping on and off at various times or would you really see 2000 people logging in all at once? Make sure your test case is as close to the real world as possible. You want to stress it some, but not to far out of the realm of possibility.
Now you could also try to catch this error and report to the connecting user that they can't connect at this moment. Then when they hit ok, you can try the connection again. That user interface time should give the server time to catch up.
HTH
Chris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!