Ruediger Berlich wrote:
Hi there,
I am in the process of speeding up communication between a server and its clients. Communication involves serialized class data. Messages can be as large as 100 kilobytes.
I have done some measurements which have shown that, in a cluster with Gigabit networking, most overhead of the parallelisation seems to come from the Broker infrastructure and the process of (de-)serialization. Network latency and/or bandwidth seems to play only a minor role in this environment.
Hence, apart from optimizing my broker, I'm looking for ways to optimize the serialization process, as used in my application. As messages are discarded as soon as they reach the recipient, versions of serialized data do not play an important role.
Apart from decreasing the frequency and size of data exchanges and using binary transfers in a homogeneous environment, another way of speeding up the application seems to be the "Class Information" section discussed e.g. in http://www.boost.org/doc/libs/1_41_0/libs/serialization/doc/special.html
If speed is paramount and you don't need versioning, you can mark your classes accordingly. If you're using this for passing data over the network and you have control over both ends, versioning should not be necessary. That could make a huge difference. Also if you turn off tracking, that could make big difference as well.
Also, BOOST_IS_BITWISE_SERIALIZABLE(my_class) might help. One question I have about this is whether a std::vector<POD> would be accessible to this optimization ? I use quite a few of them.
collections of types marked with BOOST_IS_BITWISE_SERIALIZABLE(my_class) serialized with the binary_?archive should be pretty much as fast as any other method. On my system when I disassemble these types, one can verify that it boils down the minimum code possible- at least with my MSVC compiler. One large bottle neck I've found is in the usage of standard stream buffer. Replacing this with a custom implemenation might help.
Do you have further suggestions for ways of influencing the Boost.Serialization library ?
see all of the above. Carefully read the serialization traits section of the documentation. I should say that I'm very skeptical of attempts to make such improvements without subjecting one's own use cases to a profiler. The library has a section "performance" which has a few tests which work with the bjam build/test system. You should add your own tests here and run them before doing too much.
Thanks and Best Regards, Ruediger
Robert Ramey