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

Optimize avni_server jvm config for prod env #1578

Closed
Tracked by #1580
himeshr opened this issue Apr 18, 2024 · 3 comments
Closed
Tracked by #1580

Optimize avni_server jvm config for prod env #1578

himeshr opened this issue Apr 18, 2024 · 3 comments
Assignees

Comments

@himeshr
Copy link

himeshr commented Apr 18, 2024

Optimize avni_server jvm config for prod env.
We have recently made following config changes to optimize memory and cache usage for avni_server:

avni_server_opts: "... -Xmx7168m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/avni_server/ ..."


avni_server_cache_max_entries: "100"
avni_server_cache_ttl_seconds: "300"
avni_server_cache_max_weight: "3000"

There is need to further optimize this keeping in mind that the prod ec2 instance will be a 4gb RAM , 2 CPU units machine with 1 GB of additional swap space.

#Approach
We will retain the current t3.large ec2 instance for prod-avni-server, which has 8gb ram, but apply jvm config that should work for a 4gb machine. After which we'll monitor for performance and threshold limits breach / Repeated GC need. If they remain within bounds, we'll downgrade the system to a t3.medium ec2-instance.

@himeshr himeshr self-assigned this Apr 18, 2024
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Apr 18, 2024
@himeshr himeshr moved this from New Issues to In Progress in Avni Product Apr 18, 2024
@himeshr himeshr mentioned this issue Apr 18, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Apr 18, 2024
@himeshr
Copy link
Author

himeshr commented Apr 18, 2024

Explanation for config changes done:

Config Meaning
avni_server_cache_max_entries: "100" Cache max of 100 entries like GlificContactPhoneNumber, etc.
avni_server_cache_ttl_seconds: "300" Cache entries for a max of 5 mins
avni_server_cache_max_weight: "3000" Cache max of 3000 * 100 locations
-Xms2560m -Xmx2560m Set start and max heap space to 2.5GB
-XX:MaxMetaspaceSize=512m -XX:CompressedClassSpaceSize=256m Set max MetaSpace and CompressedClassSpace to these to limit non-heap space
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{avni_server_access_log_dir}}/ -XX:OnOutOfMemoryError="shutdown -r" Configuration for taking heapDUmp and restart on OOM error
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=50M -Xloggc:{{avni_server_access_log_dir}}/gc.log" Config to capture gcc logs info for later analysis
-XX:+UseParallelGC -XX:+UseGCOverheadLimit -Xss=1m Defaults for jvm 8, not set but would like to be applied

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Apr 19, 2024
@1t5j0y 1t5j0y moved this from Code Review Ready to In Code Review in Avni Product Apr 19, 2024
@1t5j0y 1t5j0y moved this from In Code Review to QA Ready in Avni Product Apr 19, 2024
@vinayvenu vinayvenu moved this from QA Ready to Done in Avni Product Apr 22, 2024
@himeshr himeshr moved this from Done to Further Action Required in Avni Product Apr 23, 2024
@himeshr
Copy link
Author

himeshr commented Apr 23, 2024

As of now(23 Apr 2024, 5th day from deployment of the jvm and server config changes), it looks like the jvm config targeting a 4gb machine is working fine. Total JVM memory has remained at around 3 GB.
This leaves us with enough spare mem for other operations to do on the Prod-server for debug, etc..

Will monitor for the day and change the instanceType back to t3.medium if things look fine.

CC: @1t5j0y, @vinayvenu

@himeshr
Copy link
Author

himeshr commented Apr 26, 2024

Downgraded Prod server EC2 instanceType back to t3.mediumfew days ago, performance looks good.

@himeshr himeshr moved this from Further Action Required to Done in Avni Product Apr 26, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
himeshr added a commit to avniproject/avni-infra that referenced this issue Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants