CatOps
5.09K subscribers
94 photos
5 videos
19 files
2.57K links
DevOps and other issues by Yurii Rochniak (@grem1in) - SRE @ Preply && Maksym Vlasov (@MaxymVlasov) - Engineer @ Star. Opinions on our own.

We do not post ads including event announcements. Please, do not bother us with such requests!
Download Telegram
Netflix в своём блоге рассказывает как они анализируют использование CPU Java приложениями с помощью flame graphs.

Это достаточно большая стаья с примерами, видео с конференции и роадмапом.

Бонусом: статья об использовании flame graphs для визуализации CPU usage от всё тех же Netflix. На этот раз для NodeJS приложений
#netflix #java #nodejs #cpu
У меня сегодня будет JavaDay!

Первая статья, которой я хочу поделиться — записки SRE из Google Andrew Brampton о том, как жить с Java в продакшене. Главное, когда читаешь материалы от Google, помнить, что ты не Google :)
https://www.javaadvent.com/2017/12/running-java-in-production.html/amp

Дальше Daniel Bryant рассказывает, как запускать Java приложения в Docker и оркестрировать это счастье с помощью Kubernetes. При чём, рассказано на примере minicube, что прикольно, потому что убирает зависимости в виде тех или иных облачных сервисов:
https://www.oreilly.com/ideas/how-to-manage-docker-containers-in-kubernetes-with-java

И более низкоуровневая движуха — серия статей на 5-10 минут, в которых описана "анатомия" JVM. Там ещё прикольная табличка, которая отражает, какие темы покрывает та или иная статья:
https://shipilev.net/jvm-anatomy-park/

Enjoy!

#java
This post will be interesting to those, who run Java application in Kubernetes. Specifically, if you use OkHttp client for Java.

Kubernetes network load balancing using OkHttp client - the name speaks for itself. Basically, the problem is that OkHttp uses persistent connections to communicate with the peers. Therefore, IPVS - the default K8s load balancer - is unable to properly balance those connections. Thus, you may have all the connections served by a single replica of your downstream service!

This article provides some useful insights on how to trace down this issue and how to fix it in your code, as well as it mentions tradeoffs of such fix.

#kubernetes #java #programming
Production Considerations for Spring on Kubernetes is a long detailed articles on the consideration you have to take when running Spring Boot applications in Kubernetes.

It starts with how do you build your image and covers topics such as graceful shutdown, CPU/Mem requests and limits, configuration changes and so on.

From my understanding the primary target audience is Java developers. However, you can get much value from this article since it explains some specifics of how Java OCI images are built as well as some specifics of how Kubernetes works. Also, it may provide you some conversation-starters to share the best practices with your developers. Hence, probably not all of them have read this (or similar) article.

Some disclaimers:
- This article was written in the end of 2022
- It has Spring Boot 2.x in mind. Spring Boot 3.x is already available and has many changes compared to 2.x. Yet, 2.x is still widely adopted.
- Thus, some recommendations may change as well as new recommendations may appear for Spring Boot 3.x
Some takeaways:
- Use the latest LTS JDK version. If you‘re still on Java 8, at least make sure that you‘re using the latest patch version.
- Use cloud-native image builders such as JIB.
- Make sure that your application can be shut down gracefully. You may want to use preStop hook with a simple sleep and adjust the terminationGracePeriodSeconds setting to achieve that.
- Be mindful about your Liveness and Readiness probes. Spring has a default health endpoint but it usually checks the overall health of an application including downstream connections to the databases, etc. It’s suboptimal to use that for Liveness probe, because K8s will simply restart your app in a loop if something happens to the DB connection.
- Spring’s Liveness and Readiness Health Groups may help to prepare your app to K8s environments.
- Profile your application before setting requests and limits
- For CPU set adequate requests and use -XX:ActiveProcessorCount parameter of JAVA_TOOL_OPTIONS to limit the number of vCPU for JVM. Thus, you can omit setting CPU limits on the K8s side.
- Make sure you have both requests and limits set for the Memory, though!
- Prefer K8s native abstractions for configuration and service discovery over Spring Cloud.
- Yet, if you cannot remove Spring Cloud easily, the article provides some advices on how to make an app more K8s-native.

So, do you use Java or Kotlin in your company? If yes, share this post with your developers!

#kubernetes #java #programming
-
🔥10👍2