Notes

My Thoughts on Java

·3 min read

For most of my life, I probably hated Java. I guess it started when I wanted to get into the Android ecosystem, back in 2019. And it looked over-complicated to handle even very minimal work. On top of that, Android ecosystem didn't look good either, with its xml based UI system, it was ugly. Now that Android has matured after moving to Kotlin and having things like Jetpack Compose, the development feels modern, although the UI/UX still doesn't feel right like iOS. And yes, I'm talking about taste.

Now recently for my object oriented programming course, I've picked up Java. And I'm somewhat enjoying it. I started working on a project in Spring Boot, and I'm feeling at home. It feels quite similar to NestJS from JS ecosystem. Although I find NestJS to be intuitive excluding the part that any ORM doesn't feel good in NestJS. But Spring with its integrated ecosystem with JPA is just perfect.

I knew a few internals about Java, how it works etc for quite a while now. It's fascinating. So I wanted to stress test a bit, just to see how it stacks up with others like Laravel. I've had bitter-sweet experience with Laravel in the past, and performance is something that used to be thrown out of the door in regular conversions. I know there are ways to improve it, but they're very hacky. And the ORM types are all over the place (until and unless you use Jetbrains IDE), due to Laravel's commitment to use magic. On top of that, ......

It's not a rant about Laravel, so moving on.

So in order to stress test, I created a Spring Boot project with SQLite which returns a paginated findAll query. I summoned Oha, and I asked to sustain 10k RPS for 2 minutes, and here are the results.

Performance Stats
CPU and Memory Usage

It was bottlenecked by the CPU, ram usage was quite low, at least not something that I assumed. Overall, the application was able to survive the sustained stress. Keep in mind that, it is hitting a fairly simple route, and this doesn't portray production workload, for that, using tools like K6 would give more realistic results.

SQLite also factors into this, because I believe the results would've not been this good if I had used a different database like MySQL or PostgreSQL. There is network roundtrip, database resources and everything would slow down due to IO. SQLite is a fascinating beast in its own right, and I hope to explore it further someday.

I'll do more tinkering with Java in the coming few months, and I look forward to sharing new things I discover.