kapitan
kapitan copied to clipboard
Large performance regression comparing to using jsonnet from command line
Describe the bug/feature
I use kube-prometheus as part of my kapitan project.
When using time jsonnet -J ../../lib/kube-prometheus -m manifests monitoring.jsonnet to compile the project with plain jsonnet i do get a compile time of around 6 Seconds. If i, however use kapitan compile the compilation takes about 85 Seconds. This discrepancy is too large IMO and i would like to find out why the compilation takes so much longer using kapitan
To Reproduce
Steps to reproduce the behavior:
Integrate kube-prometheus as a kapitan component with the vendor directory inside libs
run kapitan compile
Expected behavior The compilation with jsonnet using kapitan should also take around 6 Seconds
** If it's a bug (please complete the following information):**
python --version: 3.8.5pip3 --version: 20.1.1Are you using pyenv or virtualenv?No
(Jsonnet dev here)
@joseffilzmaier Are you perhaps using https://github.com/google/go-jsonnet when calling Jsonnet from cmdline? IIUC Kapitan still uses cpp implementation under the hood, which is known to be way slower.
@sbarzowski Hi, Thanks! - Yes, i'm using the golang version of jsonnet.
Is there any way to use the golang version of jsonnet within kapitan (or is it planned to be integrated)? The long compile time is quite annoying ...
@joseffilzmaier thanks for reporting. Can you share a bit more details please: is this a regression - did you have better performance with a previous version of kapitan and what version? How many targets are you compiling and are you just compiling this one kube-prometheus component? Golang jsonnet requires a few non obvious changes to kapitan but is still work in progress...
@ramaro Hi!
I do not know if this is a regression - version 0.29.1 is the only one i tried.
I am compiling 10 targets, but all of them compile in <1 sec except the kube-prometheus which takes ~85 secs.
Also, if i just compile kube-prometheus with the --targets selector, the performance is the same
@joseffilzmaier thanks! Yep, sounds like a cpp jsonnet issue, unfortunately. I'll let you know when a functional golang jsonnet version of kapitan is availabe in pre-release or even in a branch so you can try it out, if that helps?
@ramaro Yeah, thanks, that would be nice! The functionality isn't lacking - however the long compile time is somewhat annoying. I'd subscribe as a tester if the go-jsonnet branch emerges :+1:
cf.https://github.com/deepmind/kapitan/issues/144 also.