💻 Sitemap
-
First naive idea: just synchronized • Second attempt: lock striping • Problem #1 — Fixed Parallelism • Problem №2 — resize • Problem #3 — memory overhead • Architecture of ConcurrentHashMap (JDK8) • End-to-End put operation • When CAS Does Not Help • When a bucket turns into a tree • Resize — the most difficult part • Java Memory Model • CPU Cache Effects • Impact on GC • Real production case • Main trade-offs • The most important engineering idea • Engineering Intuition • Main conclusion
-
Introduction • 1. The Evolution of Architectures • 2. CQRS and Event Sourcing • 3. DDD — Designing with Meaning • 4. Reactive Architectures • 5. How to Choose an Approach • Pitfalls • Event Sourcing - Explodes Complexity During Migration • DDD — Requires Discipline in Naming Entities (and More) • Microservices Increase Infrastructure Costs • Conclusion • A Test: The Level of Architectural Thinking in a Java Developer
-
What is a variable • Variable Declaration Syntax • Variable Naming Rules • Examples of Valid Names • Basic Data Types (Briefly) • Code — Examples of Types • Declaration vs Initialization • Dynamic Initialization • Scope and Lifetime • Example: Nested Scopes • Initialization Inside a Block • Restriction: you cannot declare the same names in nested scopes • Constants • Recommendations • Homework • Test — How well did you understand the lesson?
-
1. Basic truth: Stream vs For — this is not an equal battle • 2. Why for is faster • 3. Why Stream is Slower • 4. Boxing — the main killer of performance • 5. When Stream is NOT worse • 6. When Stream is severely losing • 7. JIT and why the results "float" • 8. CPU cache and call order • 9. Practical Rule for Selection • Use for if: • Use Stream if: • 10. Final Conclusion • ⚔️ Stream vs For in Java — maximum detailed comparative table • ⚡ Stream vs Loop - Code Example with Comments
-
1️⃣ HashMap / TreeMap / TreeSet (not thread-safe) • 2️⃣ SynchronizedMap / SynchronizedSortedMap / SynchronizedSortedSet • 3️⃣ ConcurrentHashMap • 4️⃣ ConcurrentSkipListMap / ConcurrentSkipListSet • 5️⃣ AtomicInteger / AtomicReference / AtomicLong • Tables for Comparison: One Element, Two Threads • Table: one element is edited by two threads + new key is added • Comparison of Thread-Safe Sorted Collections • 🔹 Conclusions • 🔹 Practical Rule
-
Preface • Comparison of Approaches to Parallelism in Java • 1️⃣ Fork/Join Framework • Key elements: • Example: • 2️⃣ CompletableFuture — asynchronous programming with functional style • Main features: • Example of a CompletableFuture chain: • 3️⃣ Virtual Threads (Project Loom) • Advantages: • Example of Virtual Threads: • 4️⃣ How to Choose the Right Tool • Transition from Threads to Modern Tools • On what basis CompletableFuture makes decisions • Virtual Threads (Project Loom) — The Future of Multithreading in Java • In Brief • Example: Regular Threads vs Virtual Threads • Key Advantages • When to Use • Limitations and Pitfalls • Practical Migration • Summary • Virtual Streams Loom as a Metaverse • Comparison of Approaches to Parallelism in Java and Prerequisites for Choosing • Conclusion
-
What the loop consists of • Loop for • Decrementing the counter • Step of changing the counter • Loop while • Loop do...while • Operators break and continue • break — interrupting the loop • continue — jump to the next iteration • Summarizing • Homework • Test — How well did you understand the lesson?
-
Signs of a legacy project: how to recognize an old ship • 1. Restore observability: turn on the light in the machine compartment • 2. Stabilize the centers of chaos: extinguish black holes • 3. Build test insurance: secure the borders • 4. Update the foundation: replace rotten boards • 5. Remove coupling: restore the integrity of the body • 6. Return knowledge to the team: eliminate the cult of the "sole priest" • 7. Modernize gradually: without revolutions • 8. Update the infrastructure: give the ship a next-generation engine • 9. Continuous repayment of debt: small steps give a long life • The result: old ships sail long if they are cared for • Quick Diagnosis of Your Legacy Project • Test — How Much Has Your Project Become Legacy
-
1) Simple if / else • 2) else if — chain of checks • 3) Comparison Operators and Negation • 4) Logical operators: && (AND) and || (OR) • 5) Ternary Operator — Compact, but Cautious • 6) switch — when there are many discrete options • 7) A small cheat sheet for debugging • Test — How well did you understand the lesson?
-
Diagram - Java Memory Model - Heap / Non-Heap / Stack • Java Memory Deep Dive: how objects, primitives and methods live in memory • Java Memory Example: Explanation • Java Caching and GC: how SoftReference affects the life of objects in memory • Java SoftReference Cache Example: Explanation • JIT Compiler with JVM, JIT and Code Cache
-
1. Goroutine vs Thread • 2. Channels — безопасный обмен данными • 3. Unbuffered vs Buffered Channels • 4. Select — ожидание нескольких каналов • 5. Timeout / Deadline • Сравнение Go и Java по основам параллельности • Контекст для отмены и таймаутов: `context.Context` vs Java • Пример на Go • Как это решается в Java • Советы и нюансы • Сложные кейсы повышенной сложности • 1. Worker Pool (пул воркеров) • 2. Fan-In / Fan-Out • 3. Timeout / Отмена цепочки задач • Итог
-
2. Virtual Threads — millions of lightweight threads • ✅ Advantages of Virtual Threads • ❌ Disadvantages of Virtual Threads • 3. GraalVM — universal accelerator • ✅ Advantages of GraalVM • ❌ Disadvantages of GraalVM • 4. Quarkus — Java for Clouds and AI • ✅ Advantages of Quarkus • ❌ Disadvantages of Quarkus • 5. Why this is not a replacement, but maturity • 6. General Direction
-
atomic.CompareAndSwap • stack vs heap escape • sync.Pool • goroutine stack splitting • memory consistency model • scheduler preemption • unsafe basics • cache locality • allocation cost optimization • runtime.Gosched • runtime.LockOSThread • runtime.GC • High-Concurrency Patterns • GMP Scheduler Model • Output / Conclusion
-
unsafe.Pointer • Struct field alignment (alignment of fields) • Pointer arithmetic (pointer arithmetic) • Zero-copy techniques • iota • Interface internals (itab, dynamic dispatch) • runtime.SetFinalizer • runtime.KeepAlive • Overview of Topics • Key Differences Between Go ↔ Java Philosophy • Comparative table of all terms • How to choose the approach (Go vs Java) • Conclusion
-
Goroutine parking / unparking • Work stealing • Syscall blocking behavior • Local run queue • Global run queue • Network poller (netpoller) • Cooperative vs async preemption • Goroutine blocking on IO • Scheduler + IO interaction • Netpoller (epoll + kqueue) • General Comparison Table • Output / Result
-
Build Tags • Dead Code Elimination • Package Init Order • Linker Behavior • Go Vet • Go Test -bench • Go Tool PProf • Go Tool Trace • Escape Analysis Flags • General comparison logic: how to think about Go ↔ Java • General comparison table of terms • Common Schemas and Mental Models • Practical Conclusion
-
⚡ 1. Simple explanation • 🔥 2. Example: allocations • 3. Where hidden allocations appear • 1. Collections • 2. Streams • 3. String operations • 4. Exceptions • ⚙️ 4. Where Zero Allocation is Really Important • 🚀 5. How Zero Allocation is Achieved • 🧠 6. Important point about JVM • 💣 7. Where Zero Allocation Breaks • 📊 8. Comparison of Approaches • 🏁 Result
Useful Articles:
This article is dedicated to understanding the principles of working with concurrency and synchronization in Go and Java. We will look at key approaches such as rate-limiter, non-blocking operations, ...
The period from 2010 to 2020 can be called an era of separation and scaling. Systems have become too large to remain monoliths. The solution has been microservices — small autonomous applications that...
← Related articles: Context, propagation and cancellation patterns in Go vs Java | Patterns, idioms and best practices in Go 1. Channel direction — channel directions In Go, channels can be one-w...
New Articles:
Concurrency is not about “starting many threads”. It’s about agreements between them. Imagine a restaurant kitchen: — cooks (threads / goroutines) — orders (tasks) — and the main question: how do th...
Imagine a typical production service. 32 CPU hundreds of threads configuration / session / rate limits cache tens of thousands of operations per second And somewhere inside — a regular Map. At first...
Zero Allocation — is an approach to writing code in which no unnecessary objects are created in heap memory during runtime. The main idea: fewer objects → less GC → higher stability and performance. ...