powertools-lambda-java icon indicating copy to clipboard operation
powertools-lambda-java copied to clipboard

Use jackson-jr where possible

Open driverpt opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Coldstarts in Lambda

Describe the solution you'd like Use of jackson-jr for faster startup time

Describe alternatives you've considered N/A

Additional context It's recommended by AWS the usage of jackson-jr where possible in the Documentation

driverpt avatar Feb 18 '22 14:02 driverpt

Thanks for opening this issue @driverpt. It will definitely be great to use jackson-jr instead. As of now, there will be other libraries which which end up importing jackson anyways, but if powertools itself can stop using it, is something definitely worth evaluating.

pankajagrawal16 avatar Feb 19 '22 18:02 pankajagrawal16

Can't we just include a shaded copy of Jackson JR instead of having External Dependency? Similar to what was already done in AWS SDK for Java V2 ?

driverpt avatar Feb 19 '22 18:02 driverpt

Hi, I would like to contribute to the project. Quite good experience with Java and Lambda specifically from my previous role. Could I work on this?

Neuw84 avatar May 25 '22 09:05 Neuw84

@Neuw84 Did you have a look at this? I'm interested to know what could be done here. As we already have moving stuff on metrics (#944) and logging (#965), that will cause breaking changes and imply a v2, maybe it's an opportunity to also look at the serialization fwk... But as mentioned by @pankajagrawal16, other libraries are importing jackson, so we would end up with more libraries in the end...

jeromevdl avatar Nov 16 '22 08:11 jeromevdl

Which other libraries are we thinking off?

The managed runtimes uses Jackson, but they change the package name of it, so I don't think we should consider that.

msailes avatar Nov 16 '22 08:11 msailes

I thought the log4j json layout library was using jackson, but no. It's worth having a deeper analysis, but maybe I'm wrong... (would be great).

jeromevdl avatar Nov 16 '22 09:11 jeromevdl

After analysis, several libraries are using jackson-databind:

  • aws-java-sdk-core and jmespath-java, both used in x-ray (tracing module)
  • aws-embedded-metrics (metrics module)

We could get rid of it and use something else in powertools but it would lead to an additional library then, and bigger jars, bigger cold starts...

jeromevdl avatar Nov 24 '22 10:11 jeromevdl

wont fix as other libraries are using heavier versions of jackson (see above), and we cannot embark a new library

jeromevdl avatar Jun 27 '23 12:06 jeromevdl