On Fri, 2006-05-05 at 20:50 -0700, Mark Callaghan wrote:
OK. I will provide a patch soon. I will try to provide something that=20 |
has a global default and can be changed at the session level.
The current compression code allocates two buffers using free/malloc=20 |
that are each about as large as the uncompressed packet each time a=20
packet must be written to the network. I had another change that reduced=20
that to one call to malloc and free. That change did not have much of an=20
effect on performance, but I did not run any multi-threaded tests where=20
calls to malloc and free might be more expensive. I don't know how good=20
glibc malloc is for threaded apps. I do know that other mallocs are not=20
so good (Sun has published a paper on the benefits of mtmalloc for MySql)=
maybe try some benchmarks with mysqlslap or mysql-bench and see if you
can get it to be faster. Also, memory savings are always a good thing (i
don't know if your patch saves any memory though).
From my limited understanding of MySql source, it tries to reduce the=20 |
number of calls to free and malloc, but the implementation of network=20
compression might be one case where that is not true.
As a general rule, the less calls the better. But simplicity also has
its place (easier to get something simple correct).
Is it worth my time to try to prepare a patch that either reduces the=20 |
calls to malloc and free to one per flush of a packet to the network=20
rather than two calls as is currently done? The calls could be further=20
reduced by caching the allocated buffer as part of the thread context so=20
that it is only allocated once.
possibly... some benchmarking to see if it's of any benefit to do so
would be interesting. Somebody with more knowledge of that area of code
could give some input that could be just as useful as the benchmark.
Stewart Smith, Software Engineer
MySQL AB, www.mysql.com
Office: +14082136540 Ext: 6616
VoIP: 6616 (AT) sip (DOT) us.mysql.com
Mobile: +61 4 3 8844 332
Jumpstart your cluster:
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
-----END PGP SIGNATURE-----