Send messages as Strings
Send messages as Strings

ByteStrings are a more compact representation of a sequence of octets
than are Strings. However, converting a String into a ByteString, even
a lazy one, looks at a huge number of characters before the first goes
out of scope; thus the String gets enforced effectively. As Strings,
as a list of unicode characters, have a quite memory-intense representation,
this loss of lazyness results in a memory spike that is quite significant,
at least for restricted environments like a Xen dom0, when sending the
whole Ganeti configuration.

Therefore, send messages as String over the wire to preserve lazyness.
This is sound, as our JSON representation is 7-bit clean, and hence
every character coincides with its UTF8 encoding. On a larger cluster,
this saved an order of magnitude in peak memory usage.

Signed-off-by: Klaus Aehlig <4ce51de36d9068cd7db2eec1151e0f3f95419008@google.com>
Reviewed-by: Lisa Velden <f95ae155456787aef400a49db463a62bbef84ead@google.com>

andir/ganeti,yiannist/ganeti,onponomarev/ganeti,onponomarev/ganeti,leshchevds/ganeti,andir/ganeti,ganeti/ganeti,andir/ganeti,leshchevds/ganeti,mbakke/ganeti,yiannist/ganeti,leshchevds/ganeti,ganeti/ganeti,mbakke/ganeti,mbakke/ganeti,yiannist/ganeti,ganeti/ganeti