-
-
Notifications
You must be signed in to change notification settings - Fork 976
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
API: Extremely Poor Docker Resource Utilization Efficiency #2730
Comments
can u please assign, I want to work on this issue but I will need guidance |
This mostly related of reducing docker image size |
Diffrent ways to approach this issue 1. Multi-Stage Builds Installing dependencies and building the application in the first stage. 2. Optimizing Base Images Baseline Image (Full Node.js): ~900 MB 3. Using Compression Tools please suggest a method that doesn't impact comaptibility with codebase |
Please investigate the best solution and propose it after testing on your system. It's not just RAM, but also ways to reduce the CPU overhead. |
alright sir |
The main problem I found with the API is that we have to run it in dev mode in the production Docker environment because our build process for the Talawa API is broken, so we can't use npm run start. If we resolve the build issue, we can drastically improve performance and security of the docker container. I think @varshith257 also tried to solve the build process issue a few months back, any upadates on that? |
Would this PR by @adithyanotfound provide any insights? |
@vasujain275 Why do you say the build process is broken? Can you create an issue for someone else to try to fix it? |
Yes this helps, I will start my work on this in two days, have got end sem exams |
am unassigning myself from the issue due to lack of progress |
@palisadoes plz assign me |
@palisadoes what is the load average if the api runs without docker means what is the performance . I need this because i will only focus to improve to docker performance.If not then i have to use profiler to measure what is the exact issue is it related to docker container or in code sue unOptimized query. |
@palisadoes for now i have done limits it cpu and memory usage . Also added the multistage build and used one light weight image . But i think this will handle upto a specific user . But To handle it effectivly can i use kubernatives or any other services to handle the load . So it will scale the pods if load increase and reduce the cpu usage and improve the performance.If not does the vps server where the container is hosted can it provides this mechanism. And one doubt is how i give more load to this api because at the time of testing l am the only user . |
|
Build related issue means i don't get means u are saying about unnecessary node modules or something like this are in build at the time of building the docker image there which are causing the issue. I need futher calrity. And in above u commented u are not able to run npm run start it is working fine because api service is starting |
OK. |
@palisadoes i run a load test on the server with docker and with out docker on the configuration of duration of 30 sec and 2 req/sec and found means total of 60 request will be made in 30 sec in this scenerio both have equal successRate . But when i run the same test for same duration but with different request rate like 5 req/sec means 150 request in 30 sec got the result of slightly better performance of server with out docker . But the thing is server can't handle 150 request in 30 sec as many of request is under processing and not completed the request out of this only 40 request is successful.And if u want run the docker on low end service for a small user base like in 60 sec it makes 50 to 60 (considerable factor like medicore device 4gb of ram and 4core ) it will handle the request easily if talwa-api will reduce its cpu excessive task and if we limit the cpu usage also it will handle but some slowness will be there in this scenerio. What u say? |
@PurnenduMIshra129th please coordinate with @vasujain275 There appears to be multiple causes. The application is clearly over using resources. Here is additional information. |
@vasujain275 yes u are correct build process is broken . After build it is not working properly . Also when i try to run npm run prod it is not running gives multiple error. U have any thoughts on this ? should we have use import instead of require. |
The PR was merged. We now need to:
|
@palisadoes ok working. |
@palisadoes for this i have also done for develop-postgress so what i have to do now ? will i make a pr for develop branch or develop postgress. |
@adithyanotfound why it is not working npm run prod ? any suggestion? |
@PurnenduMIshra129th please run |
|
|
Please work on this so that it's done correctly Take a look at the |
@palisadoes ok |
This will be an interesting issue. Get ready for the migration! |
@palisadoes one doubt is that in the development branch there is no need to maintain two separate docker-compose.dev and docker-compose.prod only one is sufficient .can we delete one and write the logic in one file also and give commands for common for all it will start . I will make two pull request one for develop, and for develop-postgres. |
|
@palisadoes yes i want to do the same for develop branch.If not required then i will change the build process of prod and its compose file with limit restriction.It will work same |
Should we add a GitHub workflow test to search for unused packages in package.json if it would make the long term health of the code better? Your explanation gives the impression we should to reduce the docker image size |
@palisadoes yes we can do it will very helpful and effictive against reducing the size image size. |
Please add that workflow to your PR |
@palisadoes ok will do. |
@palisadoes issue i am faced is also an important issue related to .dockerignore in this what is happening is that inside .dockerignore is not actuallly ignoring when it is building the file.As a result videos ,document section and all static images which are not required is also present in our docker images which is increasing docker image size also this is issue no 1. And second issue is after removing dev dependcies from production the code is not working which it shouldn't . Can i open issue for both of these. And in feature request wil i open a issue to create a workflow regarding this finding the unnecceasary nodemodules or packages to remove. |
@palisadoes check the pr and tell what i have to change. |
It will be a mess if we don't differentiate between dev and prod env's that's the purpose of where dev and prod docker files are introduced. I haven't gone through the whole conversation but again I want to likely restrict them, so we had two docker files :
|
Yes, we have ways for it. Can we move this discussion to #maintainers channel? |
@varshith257 I am almost done with deploying docker instance of api on the vps, the only thing left to fix is caddy. Do you have any idea why are we using self signed certificates for localhost? They are causing problems with caddy in docker setup |
I have mentioned the solution and its root cause clearly in Slack in a discussion. I have tagged you there |
@varshith257 following up the discussion on slack |
@varshith257 what to do you exactly want can you clarify the points again? Do you want dev and prod image separately if this is the problem then i can the revert the changes no problem is there still my changes is there . so just tell the points where i have to work. |
Describe the bug
We run a demonstration instance of Talawa-API on a GoDaddy VPS server running Ubuntu. It has the following resources:
Other information:
The purpose of this issue is to find ways to tune all Talawa-API Dockerfile and app configurations to lower its CPU and RAM utilization by at least 75%
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Actual behavior
Screenshots
Additional details
Add any other context or screenshots about the feature request here.
Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship
The text was updated successfully, but these errors were encountered: