[erlang-questions] Change suggestion in ranch/cowboy

Park, Sungjin jinni.park@REDACTED
Fri Sep 26 04:39:43 CEST 2014


Hi, this post might better be specifically targeted to Loic.  But anyway,
collective knowledge is better, most of the time right?  So to begin with,
items below are taken by practical necessity.  I also want to have other
people's opinions before trying.

1) Reducing Transport:controlling_process/2
Currently, ranch_acceptor calls the function to give accepted socket to the
ranch_conns_sup and the ranch_conns_sup calls the function again after
spawning a ranch_protocol.  I have a naive idea of doing it in peer-to-peer
fashion between ranch_acceptor and ranch_protocol.  I don't know of course
if there is any deep consideration in doing things that way though, and how
much improvement there would be.

2) Dynamic parameters
Currently, parameters required to run ranch_protocol are stored in the
ranch_conns_sup and given to the ranch_protocol when spawning.  Combined
with cowboy, cascaded parameters like cowboy_protocol -> cowboy_router,
cowboy_handler -> dispatch env are constant once started.  Changing any of
the above requires ranch_conns_sup restart.  Even if we could restart
ranch_conns_sup without disrupting connections, the protocols running with
the connections will still use old parameters.  This is especially annoying
if the connections have long running nature handling thousands of requests
in their lifetime.  At this point, I think that there could be kind of
parameter repository service which provide event notification service to
whatever entity that requires the parameters and let cowboy_router
subscribe to it.

Would the above worth trying?


-- 
Park, Sungjin
-------------------------------------------------------------------------------------------------------------------
Peculiar travel suggestions are dancing lessons from god.
  -- The Books of Bokonon
-------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140926/df117149/attachment.htm>


More information about the erlang-questions mailing list