Hi Aleks, On Tue, Feb 03, 2026 at 09:20:09AM +0100, Aleksandar Lazic wrote: > Hi. > > Mia mentioned in > https://www.mail-archive.com/[email protected]/msg46543.html is there > another solution for JSON reading based on > https://github.com/ibireme/yyjson/ instead of the current used mjson lib.
Interesting, I didn't notice. > This library looks nice but have some points which I would like to discuss. > > + yyjson looks active maintained vs mjson which looks stalled > + in yyjson is JSON Path build in instead of handcrafted JSON Query in mjson Honestly I don't know the difference :-) > - yyjoon looks much bigger then mjson Not that much. > That's the Idea of an Roadmap to remove mjson from HAProxy: > > * My suggestion is to add yyjson and samples for JSON Path similar to JSON > Query > and announce the new feature.. > * Add some helper functions for JSON Query to JSON Path translation. > Luckily in HAProxy isn't the JSON Query really "just" some '$.GET_VALUE"' > Stuff. > * Replace mjson calls with yyjson calls. > * Make JSON Query deprecated. > * Remove mjson from HAProxy code. > > > My questions for a good integration of yyjson into HAProxy. > > Which Memory management handling (pool, dynbuf) can I use based on the doc > of yyjson? > > https://github.com/ibireme/yyjson/blob/master/doc/API.md#memory-allocator > > What's your opinion on that? Hmmm I hadn't noticed this. That's a big negative. mjson doesn't need to allocate memory, so here we face the risk of allocating unknown amounts based on the document's contents, right ? Malloc() is already a bottleneck on large systems, it represents up to 2 digits of the percent of CPU time used by some SSL libs. I'm seeing that they also implement pools but then one needs to implement them by thread otherwise you lose thread safety. It could be helpful to understand why this lib needs to allocate RAM when others do not. We're really trying to stay away from memory allocations on the fly as they cause a lot of trouble under load (or even attacks). It could be more acceptable to make it work with fixed size buffers even it it uses more on average rather than random size based on contents. Willy

