Monday, May 23, 2005

RPC and protocol bloat.

While implementing rpc stuff, I noticed that the protocol bloats. Here's an example.

remote.text( 's' ) becomes ('text', 0, ('s',)) which becomes some 40 or so bytes once marshalled. A byte id and a single byte for the letter would be 2 bytes in contrast.
The problem about ('text', 0, ('s',)) is that it has more information. It carries the method to be invoked remotely, what type of command it is ( i.e. a call and not an error message ), and the argument-list for the remote method in an easely digestible form.

I realize I could optimize somewhat with a fancy marshaller, that negotiates formats with foreign marshallers, like templates or identifier lookup lists.

But then let's say each tiny message translates to abou 50 byte. a user can only type around 2 baud, so the generated netflow would be around 100baud/user. you can support at least 128 users on a 24kB modem line then ( assuming they do not do worse things then typing and pasting short text ).

Is optimizing at this point really worth it?

I guess I should just encapsulate properly, and later if I really want I can still try to optimize ('text', 0, ('s',)) structures to a few bytes.

No comments: