fix: reduce Lambda layer size by building Arrow without ICU #3336
Open
bujjibabukatta wants to merge 1 commit into
Open
fix: reduce Lambda layer size by building Arrow without ICU #3336bujjibabukatta wants to merge 1 commit into
bujjibabukatta wants to merge 1 commit into
Conversation
Arrow 22 links against libicu when it is present in the build environment. Dockerfile.al2023 was installing libicu, causing the AL2023 Lambda layers (Python 3.12/3.13/3.14) to bundle libicudata.so.67 (~30 MB), libicui18n.so.67, and libicuuc.so.67 - a ~37 MB increase that pushed the unzipped layer past 200 MB and broke deployments that stack multiple layers. The AL2 Dockerfile (Python 3.9-3.11) never installed libicu, so Arrow 22 already compiled without it there and those layers stayed at ~167 MB. Fix: - Remove libicu from Dockerfile.al2023 dnf install. - Add -DARROW_WITH_ICU=OFF to the Arrow cmake invocation. - Drop libicudata.so.67, libicui18n.so.67, libicuuc.so.67 from the bundle loop. - Strip the bundled lib/*.so files to recover a few extra MB. Expected layer size after this fix: ~167 MB (back to pre-3.16.1 levels). Co-Authored-By: Bujji Babu Katta & Srihari Ponakala
bramhanandlingala
approved these changes
May 17, 2026
Author
|
Hi @dheerajinampudi , Could you please verify and merge pull request ? Thanks |
Collaborator
|
Hi @bujjibabukatta looks good, thank you for handling this! |
kukushking
approved these changes
May 21, 2026
kukushking
reviewed
May 21, 2026
| echo "WARNING: ${libfile} not found on this image" | ||
| fi | ||
| done | ||
| find lib -name '*.so*' -type f -exec strip "{}" \; |
Collaborator
There was a problem hiding this comment.
This warrants a small comment: strips the symbol tables / debug info from the binaries.
Author
|
Hi @cournape could you please approve? |
Author
|
Hi @jaidisido @kailukowiak could you please approve? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Reduce Lambda layer size by building Arrow without ICU
Closes #3331
Problem
Arrow 22 links against
Library | Size -- | -- libicudata.so.67 | ~30 MB libicui18n.so.67 | ~4 MB libicuuc.so.67 | ~3 MBlibicuwhen it is present in the build environment.Dockerfile.al2023was installinglibicuviadnf, which caused the AL2023 Lambda layers (Python 3.12 / 3.13 / 3.14) to bundle three ICU shared libraries:This added ~37 MB to the unzipped layer size, pushing it past the 200 MB Lambda limit and breaking deployments that stack multiple layers. The AL2 Dockerfile (Python 3.9–3.11) never installed
libicu, so those layers were unaffected and stayed at ~167 MB.Changes
libicufrom thednf installlist so it is never present during the Arrow build.-DARROW_WITH_ICU=OFFto the Arrowcmakeinvocation to explicitly disable ICU support regardless of what is installed.libicudata.so.67,libicui18n.so.67, andlibicuuc.so.67from the bundled.socopy loop (they are no longer needed).stripon all bundledlib/*.sofiles after copying to recover a few extra MB.Result
Expected unzipped layer size after this fix: ~167 MB — back to pre-3.16.1 levels — unblocking users who stack multiple Lambda layers.
Testing
Built the AL2023 layer locally and confirmed:
- Layer size is back within the 200 MB Lambda limit.
Fix: Reduce Lambda layer size by building Arrow without ICU Closes #3331libicudata.so.67,libicui18n.so.67,libicuuc.so.67are no longer present in the zip.pyarrowimports successfully and core functionality works without ICU.Problem
Arrow 22 links against libicu when it is present in the build environment. Dockerfile.al2023 was installing libicu via dnf, which caused the AL2023 Lambda layers (Python 3.12 / 3.13 / 3.14) to bundle three ICU shared libraries:
Library Size
libicudata.so.67 ~30 MB
libicui18n.so.67 ~4 MB
libicuuc.so.67 ~3 MB
This added ~37 MB to the unzipped layer size, pushing it past the 200 MB Lambda limit and breaking deployments that stack multiple layers. The AL2 Dockerfile (Python 3.9–3.11) never installed libicu, so those layers were unaffected and stayed at ~167 MB.
Changes
building/lambda/Dockerfile.al2023 — Remove libicu from the dnf install list so it is never present during the Arrow build.
building/lambda/build-lambda-layer.sh — Three changes:
Add -DARROW_WITH_ICU=OFF to the Arrow cmake invocation to explicitly disable ICU support regardless of what is installed.
Remove libicudata.so.67, libicui18n.so.67, and libicuuc.so.67 from the bundled .so copy loop (they are no longer needed).
Run strip on all bundled lib/*.so files after copying to recover a few extra MB.
Result
Expected unzipped layer size after this fix: ~167 MB — back to pre-3.16.1 levels — unblocking users who stack multiple Lambda layers.
Testing
Built the AL2023 layer locally and confirmed:
libicudata.so.67, libicui18n.so.67, libicuuc.so.67 are no longer present in the zip.
pyarrow imports successfully and core functionality works without ICU.
Layer size is back within the 200 MB Lambda limit.