On Wed, Oct 17, 2012 at 4:46 PM, AD <
straig...@gmail.com> wrote:
> For #1, would that be as simple as implementing a send_multi so that the
> json encoding happens once?
Yes. Or, as I did, split message preparation/encoding and sending into
two parts. Make sure that prepared message contains just 3-4 binaries
with content necessary for all available transports - raw json string,
quoted json string, double quoted json string. Sending between
processes such tuple with just few binaries is very fast, since
binaries are not copied, but only referenced.
> trying to backtrack through the code, looks like send() calls Rpid ! go
> which then falls into here
>
> go ->
> Req1 = sockjs_http:unhook_tcp_close(Req0),
> reply_loop(Req1, SessionId, ResponseLimit,
> Fmt, Service)
>
> And all the pain is in the sockjs_util:encode_frame() work ?
I've stripped all the code related to "go" and "reply" mechanisms and
simplified websocket transport to just one process, etc - as Majek
said.
Those two optimizations were enough to give a huge boost to the server
in terms of broadcast speed. HTH