[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Socket
- From: Ketmar Dark <ketmar@...>
- Date: Sat, 21 Jul 2007 14:54:26 +0300
On Sat, 21 Jul 2007 04:15:10 -0700 (PDT)
gary ng <firstname.lastname@example.org> wrote:
> Yes, I am doing it this way too. But without unix
> domain socket, it can get complicated too(how to avoid
> port number collison) and there is no such thing on
you can use pipes in Windows, but somebody %-) should write such a
module for LuaSocket (it shouldn't be too hard). i have no Windows on
my box anymore, and just missed this issue. %-)
> However it still cannot solve the problem. Again using
> my SQL as an example. Because it is unpredictable, may
> be 9/10 times, I get immediate result within that
> single thread. Using the seperate task way, there
> would be yet another layer of data passing which would
> hit make the performance much worse(if I have a large
> result set) 9/10 times.
actually passing data with pipes or unix-domain sockets is very fast.
and you can make an SQL server helper not to spawn each time you need a
data. just let it wait for some time for another request before
shutting down. then you can write SQL-helper app with LuaTask and don't
care about it's crashes ('cause it will be restarted anyway) but have a
very little slowdown for continuous requests.
or someone may write a library for SQL server communications in pure
Lua (any good SQL server should support tcp/ip connections, i think
%-). then we can treat SQL-fetching like ordinary socket coroutine. i
did something like that for one of my old projects which uses SQLite
engine. SQLite is not thread/task safe, so i wrote a simple tcp
`server' for it with proper locking.