"accept" and socket read/write
Dr. Hawkins
dochawk at gmail.com
Thu Feb 12 11:15:14 EST 2015
On Thu, Feb 12, 2015 at 7:30 AM, Richard Gaskin <ambassador at fourthworld.com>
wrote:
> Dr. Hawkinsv wrote:
> > My thinking is that the application launches, and then it uses shell
> > commands to launch, say, three other instances which will listen on
> > three other ports. Initial connections would be round robin-ed (?)
> > to the four ports. Crude, but possibly effective.
>
> A lot of load balancing systems use round-robin. It may be crude, but
> widely used.
>
That was my thinking. And the programs could talk to one another so that
the most heavily loaded gets a lower share of new connections.
There is still the issue of keeping a stack running on a headless system.
I did some testing a couple of years ago launching standalones and
confirming that that the could indeed do things in preOpenStack before
attempting to open the main card (and crashing as a result, due to the
lack of an Xserver . . .)
>
> > Richard Gaskin wrote:
>
> > In the scenario I see, it wouldn't be on server, but an application:
> > revOpenDatabase() is *far* to expensive to call on each instance;
> > the port needs to stay open and connected to the db. (~500 ms to
> > open vs. ~20ms to tap)
>
> We need to call revOpenDatabase from a CGI because the CGI is being
> launched with each request. With an always-on socket server it should need
> to connect to the DB only once when it boots, which would ideally happen
> when the system boots so it's always up and running and ready to handle
> requests at any time.
>
> Conjecture about parallelism aside, half a second seems a very long time
> just to open a DB connection. It may be worthwhile submitting a bug report
> so that can be reviewed.
>
I'll time it again, but I think that's what it came to for a remote
machine but with a good connection
Then again, the broad variance you've noted (as short as 20ms) suggests
> there may be something else at play. What could cause such a dramatic
> difference in the execution of a relatively simple connection? What other
> processes are running on that server?
I think opening the database and authenticating is more computationally
intensive.
Not much else is running when I do that; it's actually my quad-core desktop
(but at another site)
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
More information about the use-livecode
mailing list