[pve-devel] [PATCH common] properly encode YAML via YAML::XS
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Sep 18 14:35:55 CEST 2020
On 9/18/20 9:13 AM, Fabian Grünbichler wrote:
> On September 17, 2020 5:06 pm, Thomas Lamprecht wrote:
>> Was this issued raised on the currently used module's upstream?
>> Maybe we/they could fix it there too, helping more than just our use
>> case.
>
> not raised, but given the docs/description I'd say chances are rather
> slim:
>
> This module implements a subset of the YAML specification for use in
> reading and writing CPAN metadata files like META.yml and MYMETA.yml. It
> should not be used for any other general YAML parsing or generation
> task.
>
> it's based on/derived from YAML::Tiny, which states:
>
> It only supports a very basic subset of the full YAML specification.
>
> Usage is targeted at files like Perl's META.yml, for which a small and
> easily-embeddable module is extremely attractive.
>
> Features will only be added if they are human readable, and can be
> written in a few lines of code. Please don't be offended if your request
> is refused. Someone has to draw the line, and for YAML::Tiny that
> someone is me.
ah ok, thanks for pointing that out.
>>
>>
>> That said, I have no real objection against using this XS binding of
>> libyaml-0-2.
>> btw. we get that already installed on ceph setups through the dependency
>> chain: ceph-mgr -> python3-yaml -> libyaml-0-2
>
> install size is also very small (xs+lib are ~200kb), memory overhead
> probably quite a bit more? we could load it only in the code-path where
> we render yaml ;)
>
Did some simple measurements of RSS from freshly restarted daemon/proxy workers
without client requests yet (Daemon module bases on CLIHandler which includes
CLIFormatter). I repeated them about 10 times and recorded min/max values:
pvedaemon worker:
before: max: 125072 min: 124968
after: max: 124500 min: 124316
pveproxy worker:
before: max: 129184 min: 128816
after: max: 128536 min: 128420
This isn't probably to significant statistically, but it actually seems that using
libyaml XS bindings saves RSS over the perl-modules CPAN one.
This comes probably mostly from the fact that it uses XSLoader[0], which allows
dynamic on-the-fly loading of libraries, so it is already only loaded once really
used.
[0]: https://perldoc.perl.org/XSLoader.html
More information about the pve-devel
mailing list