Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[loadgenerator] Bump deps and update container base image #669

Merged

Conversation

julianocosta89
Copy link
Member

@julianocosta89 julianocosta89 commented Jan 2, 2023

Changes

For some unknown reason the loadgenerator container image had a size of 1.02GB.
When updating the Dockerfile, I've also updated the dependencies and tidied up a bit the locustfile.py.

Now the image has a size of 135MB.

Merge Requirements

For new features contributions please make sure you have completed the following
essential items:

  • CHANGELOG.md updated to document new feature additions
  • Appropriate documentation updates in the docs folder

Maintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.

@julianocosta89 julianocosta89 requested a review from a team January 2, 2023 22:41
@julianocosta89 julianocosta89 changed the title [loadgenerator] Bump deps and updat container base image [loadgenerator] Bump deps and update container base image Jan 2, 2023
@julianocosta89 julianocosta89 added the enhancement New feature or request label Jan 2, 2023
@julianocosta89 julianocosta89 self-assigned this Jan 2, 2023
@fatsheep9146
Copy link
Contributor

I think changelog is needed.

Copy link
Member

@mviitane mviitane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Install of the requirements is not working (with Docker Desktop, Mac M1):

$ docker system prune -a
$ docker compose build loadgenerator 
 [+] Building 16.2s (10/13)                                                                                                                                                                                                                                   
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 987B                                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                       0.0s
 => => transferring context: 1.04kB                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/python:3.11-alpine3.17                                                                                                                                                                               1.7s
 => importing cache manifest from ghcr.io/open-telemetry/demo:v1.2.1-loadgenerator                                                                                                                                                                      1.6s
 => [internal] load build context                                                                                                                                                                                                                       0.1s
 => => transferring context: 9.44kB                                                                                                                                                                                                                     0.0s
 => [base 1/1] FROM docker.io/library/python:3.11-alpine3.17@sha256:af8fef83397b3886ed93d2c81bf3b4e70d39c0789c1c6feb1ecb86ca9bc42a0a                                                                                                                    2.4s
 => => resolve docker.io/library/python:3.11-alpine3.17@sha256:af8fef83397b3886ed93d2c81bf3b4e70d39c0789c1c6feb1ecb86ca9bc42a0a                                                                                                                         0.0s
 => => sha256:261da4162673b93e5c0e7700a3718d40bcc086dbf24b1ec9b54bca0b82300626 3.26MB / 3.26MB                                                                                                                                                          0.4s
 => => sha256:e1c6f98fd0547fcc6cd773da260cc8d980e3beeceffd4c0805fb00942a7175e3 624.83kB / 624.83kB                                                                                                                                                      0.5s
 => => sha256:45a28ad63eb058b6b4c2b3a90a0160e7bd2eb2a4c481b313b2e3226af2b58c35 12.80MB / 12.80MB                                                                                                                                                        1.6s
 => => sha256:af8fef83397b3886ed93d2c81bf3b4e70d39c0789c1c6feb1ecb86ca9bc42a0a 1.65kB / 1.65kB                                                                                                                                                          0.0s
 => => sha256:5693bfba00d784b3bb48b1f485233a2ac845946cde2a65427e316882b3e2f564 1.37kB / 1.37kB                                                                                                                                                          0.0s
 => => sha256:bbd3f7c28acebf719a48db90839073e2d32da8a1d44d9686613ca58ec56942f9 7.05kB / 7.05kB                                                                                                                                                          0.0s
 => => extracting sha256:261da4162673b93e5c0e7700a3718d40bcc086dbf24b1ec9b54bca0b82300626                                                                                                                                                               0.2s
 => => sha256:fe2bfecb80211f62678e1546cdef5581c5a13c349b5f94fa182d6003b7e2e548 230B / 230B                                                                                                                                                              0.5s
 => => sha256:b1fe52bb1731b2f5a7a7c38544faa2cbd654ecebbf287757c5e12d0d3c0c35a9 3.06MB / 3.06MB                                                                                                                                                          0.9s
 => => extracting sha256:e1c6f98fd0547fcc6cd773da260cc8d980e3beeceffd4c0805fb00942a7175e3                                                                                                                                                               0.3s
 => => extracting sha256:45a28ad63eb058b6b4c2b3a90a0160e7bd2eb2a4c481b313b2e3226af2b58c35                                                                                                                                                               0.4s
 => => extracting sha256:fe2bfecb80211f62678e1546cdef5581c5a13c349b5f94fa182d6003b7e2e548                                                                                                                                                               0.0s
 => => extracting sha256:b1fe52bb1731b2f5a7a7c38544faa2cbd654ecebbf287757c5e12d0d3c0c35a9                                                                                                                                                               0.2s
 => [builder 1/3] RUN apk add gcc linux-headers musl-dev                                                                                                                                                                                                3.2s
 => [stage-2 1/4] WORKDIR /usr/src/app/                                                                                                                                                                                                                 0.1s
 => [builder 2/3] COPY ./src/loadgenerator/requirements.txt .                                                                                                                                                                                           0.0s 
 => ERROR [builder 3/3] RUN pip install --prefix="/reqs" -r requirements.txt
...

#0 6.923       Failed to build cffi
#0 6.923       Installing collected packages: setuptools, pycparser, greenlet, Cython, cffi
#0 6.923         Running setup.py install for cffi: started
#0 6.923         Running setup.py install for cffi: finished with status 'error'
#0 6.923         error: subprocess-exited-with-error
#0 6.923       
#0 6.923         × Running setup.py install for cffi did not run successfully.
#0 6.923         │ exit code: 1

@julianocosta89
Copy link
Member Author

@mviitane would you be able to try it again?

@mviitane
Copy link
Member

mviitane commented Jan 3, 2023

@mviitane would you be able to try it again?

I now get further, but it still fails:

#0 27.56 Building wheels for collected packages: flask-basicauth, gevent, grpcio, markupsafe, msgpack, psutil, roundrobin, wrapt, zope-interface
#0 27.56   Building wheel for flask-basicauth (setup.py): started
#0 27.73   Building wheel for flask-basicauth (setup.py): finished with status 'done'
#0 27.73   Created wheel for flask-basicauth: filename=Flask_BasicAuth-0.2.0-py3-none-any.whl size=4241 sha256=1ac0f649a72d37c37be9509708d3c5562a5e3af06b0e4e0e1aa47e8169c25f08
#0 27.73   Stored in directory: /root/.cache/pip/wheels/b7/ac/af/20577bcc2e68ce45b0b40376df225e259ee98867c4afd79c1d
#0 27.73   Building wheel for gevent (pyproject.toml): started
#0 31.13   Building wheel for gevent (pyproject.toml): finished with status 'error'
#0 31.14   error: subprocess-exited-with-error

@julianocosta89
Copy link
Member Author

@mviitane how about now?

Copy link
Member

@mviitane mviitane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started working and runs fine. Image size is now much smaller, but build time increased. It's off course debatable, which is more important.

This PR:
Image size: 183MB
Building time: 152.2s (15/15) FINISHED

Previous:
Image size: 1.21GB
Building time: 21.4s (11/11) FINISHED

Tested on M1 mac.

@julianocosta89
Copy link
Member Author

Thank you very much @mviitane, that was an interesting one.
Lets wait for some others to take a look, and if we get this merged I'll follow the same approach with the recommendationservice that has also a big image size.

@cartersocha
Copy link
Contributor

Let's discuss this on Monday! That image size reduction is huge

@julianocosta89 julianocosta89 merged commit 2d8ac56 into open-telemetry:main Jan 9, 2023
@julianocosta89 julianocosta89 deleted the loadgen-cleanup-and-update branch January 9, 2023 16:56
@svrnm svrnm mentioned this pull request Jan 15, 2023
2 tasks
jmichalak9 pushed a commit to jmichalak9/opentelemetry-demo that referenced this pull request Mar 22, 2024
…etry#669)

* Bump deps and changed container base image

* Add extra dependencies

* changelog

* Adding dependencies

* Add libstdc++

* Moving to slim image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants