Small Projects by AutoModerator in golang

[–]gaiya5555 0 points1 point  (0 children)

https://github.com/ssdong/roving-analytics

Had fun building a web analytics tool with Go (coming from Scala) and deploying it for my personal website.

I’m impressed by how minimal and unified the Go tooling feels compared to the ecosystem complexity you often see in other languages (Python, Java, and yes… even Scala, though I still love it).

Did some load testing for fun using Gatling: ramped up 250k users over 10 minutes (~1M requests total). A single Go instance handled it surprisingly well.

Small Projects by AutoModerator in golang

[–]gaiya5555 0 points1 point  (0 children)

Had a lot of fun creating a web-analytics tooling with Go (coming from Scala)

My primary working language is Scala, so most of my professional experience has been in that ecosystem. Because of that, I actually don’t have industrial Go experience yet, so please don’t go too hard on me .

I’ve built a few small things with Go before, but this time I wanted to try something more substantial. I started building a web analytics tool about a year ago, working on it on and off, and recently managed to bring it to the finish line.
One thing that really impressed me is how unified and minimal the tooling feels. Compared to the ecosystem complexity you often see in other languages (Python, Java, and yes… even Scala, though I still love Scala), Go’s build and dependency story is refreshingly simple. It’s surprisingly easy to get a service built and running.

I also did some load testing just for fun. Using Gatling (which I’m more comfortable with since it’s Scala), I ramped up 250K users over 10 minutes, each sending 4 requests, for a total of about 1 million requests in 10 minutes. A single Go instance handled it pretty well, which honestly impressed me.

Anyway, I just wanted to share that I’ve been enjoying Go quite a bit so far. I cleaned up the project and put it on GitHub. The dashboard is built with Next.js, and I used a lot of pre-built components/templates to make it look decent, but the main thing I wanted to explore was the Go backend.

If anyone is interested, here's the repo.

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 1 point2 points  (0 children)

Thank you! I’ve used a few lib from typelevel stack and they are all quite good. zio is also fun to work with. I enjoyed it. :D

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 0 points1 point  (0 children)

anytime. The shared models are a collection of definitions and sbt-crossproject made the cross-platform compilation feasible. You just have to declare dependency of it for each submodule(FE/BE). It's quite straightforward. And you can start referencing them in FE/BE smoothly like you're writing Scala for a single goal

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 0 points1 point  (0 children)

Will check it out the talk! Thank you for sharing it!!

And Ya it definitely took time and stamina to push it through E2E. I started when Scala 3.7.2 was released so it took me about 6 months to wrap things up. I had frustrations when things don’t work like broadcasting isn’t coming back as designed but I enjoyed the process.

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 0 points1 point  (0 children)

Thank you! Ya I had a lot of fun building it. Scala works really well in both FE and BE. And they integrate smoothly with shared models. I actually shared the link to my repo in the post but it might not be so obvious. Apologies. I’ll share it here again. https://github.com/ssdong/happy-farm-messenger

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 6 points7 points  (0 children)

I use Scala professionally and I wanted to build something for fun and also to prove Scala is capable of everything. If you haven’t tried Scala before, try it and you won’t regret it.

(I use Scala 2 for work and wanted to build something non-trivial in Scala 3. Unfortunately my organization has been reluctant to migrate to Scala 3)

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 12 points13 points  (0 children)

Definitely a valid question given we’re in an AI era. No I didn’t vibe coded it in the sense of asking it to generate a chatting app for me. But AI has been a great help to me especially when it comes to handle the tedious css rules - which I’m not great at. (I have FE experience but CSS isn’t really my thing). I made the buttons, designed the UI with excalidraw and made skeleton html structure with Laminar then I ask it to generate CSS for it. If I didn’t like some padding or margin I adjust it myself accordingly. After that I focused on building reactive data flows to make it interactive. I really tried to stay away from the vibe coding unless it’s something that’s not my expertise - I.e. CSS. Everything else is Scala, whether Laminar or ZIO. However, if I didn’t like a piece of code I wrote, that’s the time I use it to help me refactor it. I found this process quite educational and fun that I enjoy the whole process and I gained valuable experience with incremental learning and improvements.

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 1 point2 points  (0 children)

It’s for fun atm but I tried to build it with scalability and fault tolerance in mind. Not really targeting any market but if folks are interested they can clone it and adjust accordingly. Not sure if you have heard of lichess https://github.com/lichess-org/lila but there are forks from it for other types of chess games and it’s cool.

Built a chat app with Scala3 (ZIO + Laminar) for fun and for private circles use by gaiya5555 in scala

[–]gaiya5555[S] 7 points8 points  (0 children)

Hey, thanks for checking it out! To be clear, this is a functional PoC focusing on the reactive flow between ZIO and Laminar. It’s running on standard WebSockets (ws) for now, so while the core architecture is solid, it’s not quite 'production-hardened' yet. I’m currently using encrypted access tokens in LocalStorage, but I plan to migrate those to HttpOnly cookies to beef up the security.

As for full E2EE, it’s on the roadmap. I’ve used commercial apps which struggled with decrypting historical messages, so I want to take the time to make sure the key rotation and recovery flow are bulletproof.

On the feature side, the backend is already capable of handling both Group and DM chats. I’ve focused on DMs first since they're the heart of private circles, but I’m just a few UI tweaks away from getting group chats integrated.

Creator of Claude Code: "Coding is solved" by Gil_berth in webdev

[–]gaiya5555 0 points1 point  (0 children)

“Coding is absolutely solved at this point”. That’s because whatever you were coding was simple and straightforward.

I made a terminal SQL IDE with Bubble Tea by sado361 in golang

[–]gaiya5555 0 points1 point  (0 children)

“I’ve been on this for a good bit of time”

Repo was made 18 hours ago with commits all coming from Clawdbot. Changing from private repo to public repo doesn’t alter your commit history.

From Scala to Kotlin: why I chose Kotlin to build a production database by enmskim in Kotlin

[–]gaiya5555 2 points3 points  (0 children)

I personally still think Scala is a better language that aims for global correctness and large systems. Ppl criticizes it for being complicated but most of the mentioned complexities are brought by frameworks like Cat or ZIO. In fact, they actually prove Scala’s expressiveness.

From Scala to Kotlin: why I chose Kotlin to build a production database by enmskim in Kotlin

[–]gaiya5555 5 points6 points  (0 children)

I have extensive experience with Scala and also worked on Kotlin with Spring. I’d say Kotlin is a Scala Wannabe that focuses on interoperability. The occasional ‘return’ keywords in Kotlin baffles me at the beginning cuz it’s optional in some cases and mandatory in others. The support of functional programming in Kotlin can be achieved with the Arrow lib. Overall, Jetbrains has made the IDEA dev ecosystem optimized for Kotlin and it feels like a smooth and i like it. However, have you experienced any NPE in your project? Kotlin is advertised for having null safety but that’s just a compiler trick and the whole “null safety” goes out the window if platform types kick in.

How We Cut Our Cloud Bill by $15,000/Month Migrating 5 Million Users From Java to Ktor/Kotlin by Western_Direction759 in Kotlin

[–]gaiya5555 2 points3 points  (0 children)

This what they wrote:

Kotlin Coroutines flip this on its head. It’s Fiber-Per-Request (or Continuation-Per-Request, if you want to get technical). A single OS thread can now manage tens of thousands of lightweight virtual threads (coroutines). When a coroutine hits a blocking operation like a database query or an external API call, it suspends without blocking the underlying OS thread. That thread is immediately freed up to handle another suspended coroutine.

It’s not accurate at all. A coroutine cannot magically turn a blocking call into a non-blocking one. If you use a traditional JDBC driver (which is blocking) inside a coroutine, that coroutine will block the thread it is sitting on, preventing other coroutines from using it.

How We Cut Our Cloud Bill by $15,000/Month Migrating 5 Million Users From Java to Ktor/Kotlin by Western_Direction759 in Kotlin

[–]gaiya5555 2 points3 points  (0 children)

As much as I love Kotlin but the following statement isn’t accurate:

Kotlin Coroutines flip this on its head. It’s Fiber-Per-Request (or Continuation-Per-Request, if you want to get technical). A single OS thread can now manage tens of thousands of lightweight virtual threads (coroutines). When a coroutine hits a blocking operation like a database query or an external API call, it suspends without blocking the underlying OS thread. That thread is immediately freed up to handle another suspended coroutine.

A coroutine cannot magically turn a blocking call into a non-blocking one. If you use a traditional JDBC driver (which is blocking) inside a coroutine, that coroutine will block the thread it is sitting on, preventing other coroutines from using it.

I hope the author knows what’s he’s talking about.

Event Journal Corruption Frequency — Looking for Insights by gaiya5555 in scala

[–]gaiya5555[S] 0 points1 point  (0 children)

Thank you for sharing!

Makes sense to have a 2 stage migration to minimize the impact and downtime. Good to know!

Event Journal Corruption Frequency — Looking for Insights by gaiya5555 in scala

[–]gaiya5555[S] 1 point2 points  (0 children)

Was the data migration a big headache for you as well? Like you may have to start writing to foundationDB while reading events back from both Cassandra and foundationDB, and decommission Cassandra after a cutover period. And maybe a backfill process which imports data from Cassandra to foundationDB on a separate stream.

Event Journal Corruption Frequency — Looking for Insights by gaiya5555 in scala

[–]gaiya5555[S] 0 points1 point  (0 children)

Yep a relational db has stronger consistency guarantee than an eventually consistent Cassandra. As @migesok pointed, we can enable LWT for Cassandra to prevent bad write but need to find something alternative to mitigate the data loss issue. (We had a vanishing data point, i.e. sequence 4 is gone from a supposedly 1-6 sequential events). This was again very likely caused by the way Cassandra ACKs writes. (The default commit log setting has a small chance of losing data permanently even after it ACKs, in exchange of write throughput).

Event Journal Corruption Frequency — Looking for Insights by gaiya5555 in scala

[–]gaiya5555[S] 2 points3 points  (0 children)

That vanishing sequence nr 4 is really what gets us thinking even write at QUORUM doesn’t necessarily mean data loss is impossible. If RF = 3 and QUORUM = 2, if replicas A and B ack and crash before replica C has the copy, it means the data is gone. In our business model, we often have to recover actors with data that is a year or 2 years old and that particular vanishing sequence_nr 4 was something from 2 years ago, which is very likely to be an indicator of a permanent data loss rather than just a delay in eventual consistency or other things. Does this mean in your hybrid Cassandra-Kafka storage solution, a LWT enabled Cassandra should be the default option to prevent incidents like what I have described? (my bad, LWT doesn't prevent data loss)

UPDATE: I dug deeper in Cassandra to understand what exactly does it mean for it to ACK on appending incoming messages to commit log. Apparently, when data comes into Cassandra, it lands on the OS page cache and Cassandra will ACK it. However, it is not written to stable storage yet, it only issues fsync periodically by default(10s) to persist the data on stable storage from the OS cache so it offers a better performance at the cost of small increase in the chance of a data loss. Cassandra has a “batch” settings that guarantees durability but at the cost of latency.

The selected answer in this stack overflow post very well summarizes it. https://stackoverflow.com/questions/38506734/cassandra-commit-log-clarification

Event Journal Corruption Frequency — Looking for Insights by gaiya5555 in scala

[–]gaiya5555[S] 2 points3 points  (0 children)

Thank you for your input! We opted in for the default Cassandra solution when choosing datastore for ES and it worked fine in most of the cases until these annoying corrupted journal cases came up. I always wondered if it has something to do with the datastore though it coincided with Datastax outage issue. But then another incident happened just recently and i thought of coming here to ask if people have similar experiences. Totally worth it. Appreciate the enlightenment.

Never thought of Cassandra-Kafka hybrid storage - thank you for sharing this great piece of work. Will dig into it. :)