How to write high-performance Java

Last updated on September 18, 2021 -

Who the hell am I?

I'm @MarcoBehler and I share everything I know about making awesome software through my guides, screencasts, talks and courses.

Follow me on Twitter to find out what I'm currently working on.

["TODO write at the end"]

We need to scale?? We need more horsepower. more machines. more kubernetes pods.

How many users can run on my tiny little machine?

written from a CRUD perspective…​

SQL server…​.

Low-Latency

Rough Table of Contents

  • "Feeling" Performance

If you are writing Java server programs, it might make sense to answer the following questions before auto-scaling your Kubernetes pods into oblivion and adding some more $$$s to your cloud provider’s bottom line:

  • How many servers do I actually need?

  • How fast is my application? Actually…​.What is fast?

  • How many users could it serve, running on my Raspberry Py? What is a modern server capable of?

  • What’s the role of memory? Network Bandwith? Garbage collection?

Let’s try and get a practical feel for these questions.

What is the order of magnitude?

Example:

  • Plain Jetty + Plain JDBC + Database Connection ⇒ 5ms

  • Plain Jetty + Plain JDBC + Connection Pool ⇒ 10ms

  • Spring Boot + everything else ⇒ 30ms

Other articles hammer you with graphs…​and 25% more speed…​and blah blah blah…​.you need to start getting a feel yourself

How to measure performance

Scale to 5000 users and then gone…​.

ab tool

spring boot

Garbage Collection

how does garbage collection work different collectors how can i enable garbage collection

breaks where your

Serialization

JSON vs protobuf vs XML…​

Profilers

how do they work…​

Latency

network…​.latency world-wide..

Memory Usage

maps are bad…​.

Serialization

JSON is slow…​.but absolutely fine…​

protobuf

what to do

be aware layers upon layers..

enable sql logging…​.

data structures…​if you have a lot, know that maps and lists and shit consume memory

chrome developer tools

what happens in 15ms:

15 MS da schickst in counter strike die position aller Spieler, ihrer Bewegung und Schüsse zum Server und zurück Und manche würden sagen Bad ping…​call their internet service provider…​"fast path".

what do you want to see

want to see a guide? course? more detail? let me know i might write something about it…​

TODO

install: ab-tool: ab -n 1000 -c 100 http://172.29.48.1:8080/

make screencasts of how fast this stuff goes..

enable garbage collection stats

difference in pauses…​..

profilers

see memory usage grow…​

Memory startup

screencasts

10m…​..spring boot 10m

-Xmx40M -Xlog:gc*:file=gc.log:time:filecount=7,filesize=8M

understand profiler

TODOS

Next

reactive programming…​coroutines…​non-blcoking blocking threads etc

Share:

Comments