From: Robert Klemme Date: 2010-10-20T18:58:41+09:00 Subject: Re: Concurrent Ruby webservices from wsdl2ruby On Wed, Oct 20, 2010 at 11:06 AM, Catherine S. wrote: > Hi, > > as a ruby-newbie I'm currently stuck with a problem (possibly more > problems?) with the setup of an webservice environment on Windows. > > 1st try: Ruby/wsdl2ruby > I've created two webservices from wsdls and I am able to run them > 'concurrently', the client - written in C++ with gSoap - is able to > connect and get the data. > > One problem was that I didn't know how to get an entrypoint like > "http://:/Path/to/my/webservice?" like it is originally stated > in the wsdls, but I used em-proxy to create two transparent proxies in a > seperate 'application' to redirect the requests to the webservices (So: > another possible cause for the problem I noticed - problem stated below) Yes, I think the issue might be with the proxies. > *** Problem *** > When running both webservices and both proxies the system is 'stable' > for 2 minutes, then it starts to get stuck. Client is getting problems, > webservice-responses delay and are delivered 'clustered' back to client > (which is not good for client). With wireshark the communication looks > ok, so perhaps a printout-problem (1). Or a thread problem > (native/green?)(2)? I rather not believe in a thread issue. After all you have only two clients and most activity seems to be IO. > This is the main problem. > > While investigating it I noticed with TCPView that there are lots of > ports in TIME_WAIT (kept by System process '0'). This seems to be caused > by the webservices. Not much data is sent on them (1kb) - another > problem. So you are saying that the orphan ports are those of the process that contains the WS? Connection establishment is relatively expensive compared to message exchange so this could well explain the slowdown you are seeing. Maybe also the proxy has difficulties handling so many orphan connections and this makes him slow down. > 2nd try: JRuby/wsdl2ruby > With the possible thread problem I switched to jruby and ran my > applications with this. On TCPView I saw that there are instances of > jruby started, finished and simultaneously another port goes to > TIME_WAIT. They remain there until my process dies/gets killed. As far > as I read, this is 'normal', but I'm not really proud of this ressources > usage and until now I didn't find the reason for starting another > jruby-instance... > > I moved my proxies to the webservices application, it's now containing > mainthread, 2 proxythreads, 2 webservice-threads and all is started, but > problems exist of course still... so, questions: > > Is the design approach in its basics - wsdl2ruby generated webservices > in a multithreaded way and transparent proxies - okay? I would > appreciate not to use a whole server (tomcat), but how can I investigate > (or solve?) the existing problems? One of my guesses is that webservices > gets interrupted while some operations... or the webservices need some > 'configuration' data (connect_timeout, recv_timeout - the gsoap-client > used something like that)? > > If it is not okay... are there any other 'easy' approaches for two > webservices from wsdl? The environment is just needed for testing, but > it is necessary to have it stable/runnable in an acceptable time... so > especially setting it up should go fast... > > > Best regards and hoping for good suggestions, Unfortunately I don't know the proxies you are using. Maybe there is a setting which allows to keep connections to the WS process open (HTTP 1.1 vs. HTTP 1.0 comes to mind). Or the WS itself only supports HTTP 1.0 or is configured to close connections after each reply. I believe you should try to keep connections alive, especially between proxies and WS. HTH Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/