[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket/soap: can I keep the connection open?
- From: Matthew Wild <mwild1@...>
- Date: Mon, 4 Oct 2010 13:43:20 +0100
On 4 October 2010 02:55, Norbert Kiesel <nkiesel@tbdnetworks.com> wrote:
> On Sun, 2010-10-03 at 22:28 -0300, Diego Nehab wrote:
>> Hi,
>>
>> I have not tried to implement support for persistent connections in
>> LuaSocket because of the complications involved. I don't know how you
>> modified the API to support multiple requests per connection, so I
>> can't tell where it is going wrong. But if you use http.request(), it
>> will close the connection as soon as it done getting the response
>> body.
>>
> I use luasoap with luasocket to send soap calls to VMware servers. This
> overall works beautifully and functionality wise I'm a happy camper
> (having a wsdl->lua converter would be nice though, but that's a
> different topic).
>
> However, for even simple tasks I end up doing dozens of SOAP calls,
> ending up sometimes doing about 1000 calls within 5 minutes. And all
> that over HTTPS (I added a little piece of code to the open method to
> call ssl.wrap on the socket). Right now even a simple call takes about
> 0.2 seconds, so I'm reaching the end of the line and I'm looking for
> speedups. Trying to re-use the connection instead of re-creating it for
> every call was/is one of my ideas.
>
> Just to see if that would work, I tried to simply comment out all
> "close" calls I could find (in socke.lua and http.lua) to see if the
> server side would accepts the 2nd call over the same connection. But
> somehow I'm missing one place, because the socket is still closed after
> the first request and I can't figure out where/how that happens.
>
As has been said earlier in the thread, even if you remove all close()
calls the server can still close the connection after sending the
response, and it probably does. Unless the server and client both
support HTTP 1.1 persistent connections then expect the connection to
close.
As Diego said, LuaSocket doesn't support HTTP 1.1 persistent
connections, and I don't know a Lua HTTP library that does (not that I
can claim to have exhaustively searched). If you're sure your server
supports them then it may be worth implementing.
Alternatively I have a HTTP client library that might be easier to
adapt. I've not tested it with persistent connections, but it may be
easier to extend to do so. The library is part of Prosody, but I have
a project here that pulls the HTTP library into something standalone:
http://code.matthewwild.co.uk/lahttp (it uses Squish to pull in
http://hg.prosody.im/trunk/file/4495403470cb/net/http.lua and a couple
of others).
It's on my todo to implement myself at some point, but I don't have
time right now.
Regards,
Matthew
PS. Is the RPC server a part of VMware? I'm wondering if HTTP is
actually requirement... :)
- References:
- luasocket/soap: can I keep the connection open?, nkiesel
- Re: luasocket/soap: can I keep the connection open?, Scott Vokes
- Re: luasocket/soap: can I keep the connection open?, Norbert Kiesel
- Re: luasocket/soap: can I keep the connection open?, Petite Abeille
- Re: luasocket/soap: can I keep the connection open?, Norbert Kiesel
- Re: luasocket/soap: can I keep the connection open?, Petite Abeille
- Re: luasocket/soap: can I keep the connection open?, Norbert Kiesel
- Re: luasocket/soap: can I keep the connection open?, Petite Abeille
- Re: luasocket/soap: can I keep the connection open?, Norbert Kiesel
- Re: luasocket/soap: can I keep the connection open?, Diego Nehab
- Re: luasocket/soap: can I keep the connection open?, Norbert Kiesel