---
title: "ZHE ZHANG (@zhangjiji) | Hashnode"
description: "ZHE ZHANG (@zhangjiji) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@zhangjiji"
---

@zhangjiji

# ZHE ZHANG

@zhangjiji · Joined January 2025

## Comments

[Is it convenient to use your Gmail? Pierre Ricadat](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/681e24bee20965f5d3d4af0f#reply-681ebb24175d41087b05b130)

Reply · Article · May 10, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[Sorry to bother you again, but I'd like to ask about cross-user processing, such as leaderboards and server-wide emails. These are very similar to singleton services. Can sharding help with this? How do you handle the pressure on these types of services?](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/681e24bee20965f5d3d4af0f)

Comment · Article · May 9, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[I'm also curious, if we use Kubernetes rolling updates, will the database read pressure be very high when the in-memory actor state is rebuilt? Pierre Ricadat](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/68101fa388ebcac2ef43f1c1#reply-681c78ed061ee51da5de0fe7)

Reply · Article · May 8, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[Regarding state reads, I imagine they happen in shardcake's behavior. Then, the ZPure DSL is run, generating events. These events are sent to the DB. After successful DB operations, the in-memory state is updated using the same event handler lifted via lift. Is my description accurate? If STM is involved, it might be harder to conceptualize, as those cross-module events would also need to be atomically committed to the DB. Could you please advise if there are any good libraries for CockroachDB? Pierre Ricadat](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/68101fa388ebcac2ef43f1c1#reply-681c71dbc97b52c5e1a91787)

Reply · Article · May 8, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[I did see akka-persistent-cockroachdb in devsister's GitHub repository, but I assume this was used before migrating away from Akka, correct? Is the actual event sourcing interaction still using Akka / Pekko, or is it implemented separately? Also, are there any recommended ZIO libraries for interacting with CockroachDB?](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/68101fa388ebcac2ef43f1c1#reply-6810e3bf082d6436d67b163d)

Reply · Article · Apr 29, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[Hello, I saw in your "Beautiful Domain Logic" slide that you discussed Event Sourcing, and it seems like events are written to both a database and a message queue like Kafka. My questions are: Is Event Sourcing actually used in games? Does the database encounter performance issues due to the large number of event records? How is Event Sourcing integrated with sharding (like Shardcake)?](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/68101fa388ebcac2ef43f1c1)

Comment · Article · Apr 29, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[Many Thanks! I feel like these tricks are worth writing a new blog post about～](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/67ada0aa241e6d265ffd7ee3#reply-67adb7a9b47c0c25401869c2)

Reply · Article · Feb 13, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[If ZPure is used together with Event Sourcing, because Event Sourcing has an EventHandler that folds events and applies them to the state, and ZPure also describes the change from the oldState to the newState, does this mean that the change function is provided by the State model and is called in both ZPure and the EventHandler? But is it still necessary to coordinate the changes in ZPure and the changes in Event Sourcing to be consistent?](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/67ada0aa241e6d265ffd7ee3)

Comment · Article · Feb 13, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[I have one more question. If there are two programs, for example, Guild and Inventory, with their states being GuildState and InventoryState respectively, and if I want to combine them to write new logic, do I need some kind of "glue" program?](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/67ad975695477e0a716474d9)

Comment · Article · Feb 13, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)

[I apologize, I'm still a bit confused about the Random part. I understand it's like defining something like: def nextInt: Program\[Int\] = ZPure.suspend(ZPure.attempt(rng.nextInt()))? Does using Scala's Random directly lead to a loss of purity? Could you please explain it a bit more concretely? Thank you.](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731/comment/677fa9708649df594c2445bf#reply-67ad9342e6b0672ff7045137)

Reply · Article · Feb 13, 2025 · [The Tri-Z Architecture: a Pattern for Layering ZIO Applications in Scala](https://hashnode.com/posts/the-tri-z-architecture-a-pattern-for-layering-zio-applications-in-scala/66b07c222ac672d4672fe731)
