Professional Documents
Culture Documents
Offer - ALL
Offer - ALL
Offer - ALL
<YOUR COMPANY>
VICTOR RENTEA – INDEPENDENT TRAINER
2023
- Email: victorrentea@gmail.com
- Phone: +4 0720 019 564
- Web: https://victorrentea.ro
- Client feedback on LinkedIN, Facebook and on https://victorrentea.ro/#testimonials
- Active on Twitter, LinkedIn, and Facebook
Technologies continuously change, tech stacks evolve, the mindset shifts, and the best practices constantly align, so…
⚠️Please find the most up-to-date version of this file at 👉 https://victorrentea.ro/training-offer
Contents
Curricula 2
DATE: 26
Fee: 26
The agenda of any topic can be tailored to fit your needs: items removed, added, or edited.
Full Training Offer – Victor Rentea victorrentea.ro
CURRICULA
Design Patterns and Principles – 2-3 days ⭐
Overview
Mastering Design Patterns helps you understand existing code, identify, and compare design alternatives, and
better communicate your ideas with your colleagues/architects. Since developers are fluent in code, the
workshop is heavily code-driven, but the focus stays on the evergreen design principles and values. In the
agenda, you’ll find a range of patterns from simple ones like Singleton, Factory Method, or Strategy, up to
strategical ones like Visitor and Saga Pattern, but don’t expect to hear the dogmatic definition of them. Instead,
we’ll explore together pitfalls, tradeoffs, and alternative designs that will fill your toolbox for writing better,
simpler code in your actual project. Along the way we’ll also explore patterns (like Proxy) that underly
mainstream framework today, as well as inter-system collaboration patterns, like commands and events,
choreography, and orchestration. One of the most important takeaways, however, will probably be the Clean
Architecture (aka Onion), implemented with a pragmatic code-first mindset.
If you want the best of this training, you can prepare in advance by:
- (MUST) READ: 5-10 minutes about each pattern in the agenda below from...
o This website: https://refactoring.guru/design-patterns or
o This book: Head First Design Patterns
- (RECOMMENDED) CODING: apply as many design patterns as possible you can to this exercise:
o https://github.com/victorrentea/design-patterns/blob/master/src/main/java/victor/training/patterns/assignment/
- (OPTIONAL) READ (15 minutes): this very influential article about Clean Architecture:
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
IMPORTANT: The patterns listed in the agenda target a backend developer using Java/Kotlin/Scala (±
Spring), C#, or PHP. For developers developing Web Frontends (Angular, React..), Games (eg Unity) or Scripts (eg
python), we can tailor the agenda for their needs during a prep-call. Even if the principles stay the same, their
materialization in patterns is highly dependent of the application challenges, language and frameworks used.
Code: https://github.com/victorrentea/design-patterns
Page 2 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Wrap-up – 30 min
- Anti-Patterns + typical workarounds
- Recap & Classification. Quiz.
Page 3 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Goals:
- Empower you to refactor continuously
- Identify Code Smells and understand typical ways to fix them
- Refactor Safely breaking large changes in safe baby-steps
- Master your IDE refactoring tools with huge impact on your productivity and focus
Structure: The workshop is composed of an extensive set of exercises, covering the most common and
dangerous code smells, that we will fix using powerful refactoring moves. In parallel with the coding part, we
will brainstorm on design topics, motivation, attitude, ethics, teamwork, and more. The best part however will
be the larger refactoring katas, ideally on snippets from the audience’ production code. The training will be
spiced with analogies, real-life stories, and jokes that will make it a very entertaining and memorable experience.
Individual Work: To make the best use of your time, the participants will not be tasked to code during the
training days. Instead, they with be provided with a prep assignment (see below) that should be worked out
BEFORE the training, individually, in pair programming (best), or even mobbing with your team. If time allows,
we can review some of the solutions and provide hints on how to further refactor the code.
🔥new [optional] Deep Hands-on Experience: We can split an online training in half-days, and have the
participants work in pairs independently for the other half of those days on more refactoring and self-study tasks
that we then review together. In other words, if you can find more time for the participants, you can get almost
twice the impact with the same training fee. – ask me for more details.
Preview: TO get a taste of it, you can watch some teaser videos (in Romanian), Code Smells and live-refactoring
sessions on my YouTube channel, or purchase my Core Refactoring training on Teachable.
Prerequisites: Working experience with Java, ideally with prior contact with bad (legacy) code.
2. Send me Production Code Snippets to refactor together (for dedicated sessions only):
- 2-3 snippets/a class of ≤ 200 lines of your project’s code
- Ideally manifesting some typical issues, eg debated at code reviews
- NOT the most complex part of your code, nor the most trivial: the point is learning and brainstorming
- Someone should be familiar with the functionality of the code
- If you don’t have time to make the extract compile, send just that file to me and I’ll fill the necessary gaps.
- Check with your lead about an NDA; if missing, anonymize the code: e.g., rename Account to “Basket”, etc..
- Deadline: the evening before the training
3. Reading:
a) Code Smells Overview: Chapter 2 & Chapter 3⭐ from Refactoring 2nd ed by Martin Fowler, 2018
or Browse an online catalog of Code Smells (fastest)
b) [nice to have] The Clean Code “bible”: Chapter 1-11 from Clean Code book by Robert C. Martin
c) [optional] Observe the tricks I use in IntelliJ in these videos: Productivity and Refactoring Tips
Agenda
The agenda should be tailored for your team in a prep-call.
Page 5 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
What to expect
Agenda
- Refactoring: definition, opportunities: Boy Scout, Comprehension-, Repent-, Preparatory-, and Planned
- Baby-steps Refactoring: break large changes in tiny safe steps, using IDE refactoring; micro-commits
- Names that are consistent, searchable, explanatory but concise
- Method Parameters: number of parameters, default parameters, boolean parameters
- Method Body: SRP and SLAb principles, function depth and Cognitive Complexity; Guard Clauses
- Data Structures: avoid prototype overload, Object.assign, objects via clojures (≤ES5), ES6 classes
- Embrace Functional Programming: pure functions, split loop and use array ops
- Concurrency: from callback hell > promises > async/await
- Error Handling patterns
- Code Smells: overview of most common micro-design issues today + solutions
- IDE Refactoring: Extract/Inline variables, methods, and constants; change signature, and more
- Larger Refactoring Exercise (~2 hours), ideally extracted from codebase of participant’s projects
Page 6 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Main Goals:
- Motivate developers to test thoroughly their code
- Understand the design insights provided by testing
- Review the state-of-the-art testing techniques of today
Prep-work:
- Read: Excellent article about different levels of testing - Practical Test Pyramid
- Coding Exercises to practice writing unit tests and mocks BEFORE the training, (mandatory for those
with less working experience) https://github.com/victorrentea/unit-testing-katas - (Java)
- [optional] Watch: A recorded TDD Coding Kata: https://www.pentalog.com/pentabar/tdd-live-coding-
kata
- Send me samples of Unit Tests (for dedicated sessions only)
o 1-3 typical test classes of ≤ 100-200 lines + production code under test
o I don’t need all the code around it I will fill create the missing code to make it compile
o At least one participant should be familiar with the code.
Code: https://github.com/victorrentea/unit-testing
Agenda
- Fundamentals
o Why test, why test-first, cost of tests, test-around-bugs
o Key Concepts: Line/Branch Coverage, Mutation Testing, Test Isolation, Flaky Test
o Testing Strategies: Pyramid vs Honeycomb
o Types of tests: Unit Tests (solitary vs social), Integration Tests
o Test anatomy, naming tests, single assert rule
- Test-Driven Development (TDD) – 2 hours
o Rules of TDD, Red-Green-Refactor workflow
o TDD Styles: Chicago(“triangulation”) vs. London(“outside-in”)
o TDD Pros / Cons, TDD in real-life
o Exercise: Classic TDD Coding Kata
o Exercise: Outside-in TDD Coding Kata [optional]
- Testing Techniques
o Creating test data
o Expressive asserts with Assert4J (assertThat)
o Parameterized Tests – uses/abuses
Page 7 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o Using “.feature” files: best practices, Behavior-Driven Development (BDD/ATDD)
o Testing Legacy Code: Characterization Testing and Golden-Master technique
o Approval Testing
o Subcutaneous tests, @VisibleForTesting
o Nested test classes
o Extending JUnit Framework – examples
- Using Mocks – 2 hours
o Reasons to Love (3) and Hate (3) Mocks
o Basic Features: stubbing, verification, argument matchers, captors, mocking statics…
o Advanced/Dangerous Features: lenient, any, doReturn, spy, times, noMoreInteractions
o Exercise: Covering Legacy Code with tests
- Design Hints from Unit Testing - 4 hours
o What am I testing here? Syndrome
o Precise method signatures
o Object Mother (over stubbing getters)
o Agnostic Domain Tests (aka Dependency Inversion Principle)
o Split by Layers of Abstraction (over partial mocks)
o Split unrelated complexity (over bloated shared test fixture)
o Mock Roles, not Objects! (over fine-grained tests)
o Decouple complexity, Functional Core/Imperative Shell segregation
o Immutable objects (over temporal coupling)
- Testing with Spring Framework – 4-6 hours
o Testing with DI: @Import, @MockBean, @Primary, profiles, test properties, @DirtiesContext
o Testing with Persistence: in-memory DB, @Transactional tests, cleanup, @Sql, Testcontainers
o Testing with External APIs: essentials of WireMock, recording proxy; vs MockServer
o Testing your API: MockMvc, strategies, building custom testing DSLs, testing authorization
o OpenAPI-freeze approval test
o Exercise: refactoring from a mock-based test to an end-to-end system test
o Optimizing run time of integration tests
o [optional] Consumer-Driven Contract Tests with Pact 1h
o [optional] Spring Cloud Contract 1h
- Code review of unit tests code from projects of participants [optional]
Page 8 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Rather than getting lost in language and framework specifics, we'll focus on the correlation between
these architectural guidelines and the fundamental design principles, keeping in mind the constraints of
our system. This workshop is open to backend developers, tech leads, architects, or anyone interested in
a lively and informative exploration of software architecture.
Understanding:
● The Dependency Inversion Principle and its role in concentric architectures.
● How to clarify logic through the Separation by Layers of Abstraction.
● The principles underpinning the Onion, Hexagonal, and Clean Architectures.
● The main challenges in breaking down a codebase into vertical slices.
Capabilities:
● How to protect your core logic against API models to simplify it.
● Extracting orchestration logic into Facades.
● Comparing and implementing strategies to decouple a monolith into subdomains.
If you want to take the best out of this training, you can prepare in advance by:
● READ this article about Clean Architecture:
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
● READ this comparison of the main architectural styles today:
https://herbertograca.com/2017/11/16/explicit-architecture-01-ddd-hexagonal-onion-clean-cqrs-how-i-put-it-
all-together/
● READ this intro to Vertical Slice Architecture https://jimmybogard.com/vertical-slice-architecture/
● WATCH this Intro to Modular Monolith: https://www.youtube.com/watch?v=Xo3rsiZYsJQ
● THINK of some ideas/questions to debate and send them to me (victorrentea@gmai.com) 1 day in advance
Code: https://github.com/victorrentea/clean-architecture
Page 9 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Agenda:
● Fundamentals – 1 hour
o Coupling and Cohesion: granularity and tensions
o SOLID principles, Beck's Rules of Simple Design
o Uniformity vs Pragmatism, under-design vs over-engineering
● Domain Model Design – 1 hour
o Identifying and delineating the “domain code”
o Align domain code with the problem to solve (DDD ubiquitous language)
o Rich domain entities that hold behavior (OOP)
o Validation: strategies to maintain domain invariants
o Domain vs Data Transfer Objects
o The Fallacy of Auto-Mappers (eg. MapStruct, …)
● Dependency Inversion Principle – 1+ hour
o Protecting the Domain: why and when?
o Adapter Pattern, plus a pragmatic variation
o Enforcing architectural boundaries – techniques
o Exercise: refactor integration logic out of domain
o Testing Integration Layer
● Orchestrating Logic – 1 hour
o Layered Architecture
o Application Services and the Separation by Layers of Abstraction Principle
o The need for Controllers?
o Evolutionary Design – hands-on
● Clean Pragmatic Architecture ✨ – 1 hour
o Domain vs Persistence – debate
o Testing the Domain Logic
o Use-case-optimized Query
o Classic Concentric Architectures: Clean, Onion, and Hexagonal; overengineering.
● Vertical Slice Architecture – 1-2 hour
o Fundamentals
o Pitfalls and Best Practices
o Exercise: Refactoring from Clean Architecture to VSA
● Command-Query Responsibility Segregation (CQRS) – 1 hour
o Endpoint-specific DTOs
o Fine-grained commands and Task-Based UI
o Data Change Contention
o CQRS Interpretations
● The Modular Monolith (Modulith) – 3 hours
o Migrating from a Legacy Big Ball of Mud to Microservices – steps & benefits
o Finding Module Boundaries
o Data Decoupling Levels
o Module API: Calls (Queries and Commands) and Events
o Relationships between Modules
o Exercise: Spring Modulith
● Wrap-up: Main take-aways; Quiz & Debates
Page 10 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Agenda
- Introduction 10m
o Definition and History
o Benefits and Drawbacks
o CAP Theorem
o Integration Paradigms: RPC, Message Queues, Shared DB, File transfer
- Design Principles 1h
o Single Responsibility Principle
o Domain-Driven Design
o From Monolith to Modulith to Microservices
- Resilience Patterns 1h
o Timeouts, Retry and Circuit Breaker
o Rate Limiter and Bulkhead
o Load Balancing and Auto-scaling
- API Design and Management 30m
o RESTful APIs, Swagger/OpenAPI
o GraphQL
o API Gateway / Backend For Frontend (BFF) pattern
o Service Discovery
- Messaging Patterns 1h
o Comparison: Messages vs RPC
o Communication Styles: request/response, pub-sub, fire-and-forget
o Messaging Features: persistent q, durable subscriber, priority q, claim check, DLQ, competing
consumers
o Smart endpoints and dumb pipes
o Choreography vs Orchestration
o Event-Sourcing overview
- Distributed Consistency 1h
o Idempotency
o Saga Pattern, Compensations and Reservations
o Transactional messaging: Outbox table, Change Data Capture (Debezium)
o Exercise: design a food delivery application
- Monitoring and Logging 20m
o Distributed Tracing
o Centralized Logging
o Health Check endpoint
o Monitoring with Prometheus/Grafana
- Build and Deploy 30m
o 12-Factor App for Cloud Development
o CI/CD
o Service Registry
o Service Mesh pattern
- Security 1h
o Authentication and Authorization strategies
o API Security Top 10 Vulnerabilities, with examples
o Secret Management
o Securing Inter-service Communication
- Testing 30m
Page 11 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o Integration/Component Testing
o Contract Testing with Pact
Prep-work: Participants with no prior contact with Domain-Driven Design philosophy should read
- Clean Architecture primer: https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
- DDD Terms: read at least pages 1-25 from: https://www.domainlanguage.com/ddd/reference/
- [Recommended] Have a taste of the DDD philosophy
o Domain-Driven Design Distilled by Vaughn Vernon (on Amazon), or
o DDD Quickly by InfoQ: https://www.infoq.com/minibooks/domain-driven-design-quickly/
(free)
This is not an entry-level training.
Code: https://github.com/victorrentea/clean-architecture
Code: https://github.com/victorrentea/ddd
Page 12 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
- Wrap-up (1 hour):
o Your first DDD project: the right domain, preparation, reading guide, planning, people
o DDD Pitfalls: DDD God Fallacy, overengineering, internal framework mania, Tech-tiger bias
o "Light DDD": 10 Takeaways applicable in any non-DDD Project
o More debates
Page 13 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Optional Preparation:
Agenda
Page 14 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Target audience:
a) Entry-level developers with no/little prior contact with Spring
b) Experienced developers with hands-on experience with Spring
⚠️ For the best experience, try to avoid mixing people from both categories in the same group.
Prep work:
- [MUST] Prepare questions, debate topics, and challenging code samples from your project
- [MUST] Clone the project and mvn install it from https://github.com/victorrentea/spring
- Juniors can get familiar with the basics via a video course on Udemy/Pluralsight/Coursera …
- More experienced developers can try out samples from baeldung.com covering topics in the agenda
Agenda
- Spring Container (2h)
o Defining Beans: component-scanning, @Import, and @Bean
o Dependency Injection Styles + Lombok tricks
o Bean Lifecycle @Scope
o Spring Profiles and ConditionalOn…
- Events and Startup (.5h): @EventListener best practices, initializers
- Configuration (.5h): @Value, @ConfigurationProperties, config sources, Cloud Config Server
- Spring Boot (.5h):
o Library version management, starters
o Convention over Configuration: AutoConfiguration, devtools
- Aspects 1h: concepts, proxy implementation, pitfalls, writing an @Aspect
- Transaction Management 2-4h
o Database ACID transaction, anomalies
o @Transactional mechanics: propagation, rollbacks, read-only tx, after-tx hooks
o Best-practices and pitfalls using Transactions, tuning performance [opt]
o JPA integration: write-behind, auto-flushing, lazy-loading, and 1st level cache
- Multi-threading: Spring thread pools, @Async, and non-blocking REST APIs; @Scheduled
- Caching: annotation and programmatic, ⚠Pitfalls (stale cache, distributed cache, hit/miss ratio)
- REST Endpoints 2h
o REST API design best practices, validation, documentation
o @RestControllerAdvice
o [optional] Introduction to WebFlux 1h (see my Reactive Programming training for a deep-dive)
o [optional] WebSockets: concepts, debug, queue/topic, security, common patterns, testing
- Observability 1h
o Spring Actuator features, adding endpoints and health checks
o Exposing metrics with Micrometer
- Spring Security 2-4h
o Spring Security Architecture, Custom Security Filters
o Authentication via: User-Password login form, Basic/api-key, Preauth Headers, JWT Token
o Authorization: URL pattern vs annotations, role vs feature-based authz, data-security, testing
o Spring OAuth2 integration (example using KeyCloak) – prep video: Intro to OAuth
o (For more please see my ‘Secure Coding’ training)
- Messages on Queues 1-2h
o Concepts: durability, topic vs queue, reply queue, consumer group, tracing, DLQ, correlationID
o Spring Cloud Stream (the new Functional-Style)
o [optional] IntegrationFlows DSL
- Testing 4h+
o Testing with DI: @Import, @MockBean, @Primary, profiles, test properties, @DirtiesContext
Page 15 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o Testing with Persistence: in-memory DB, @Transactional tests, cleanup, @Sql, Testcontainers
o Testing with External APIs: essentials of WireMock, recording proxy; vs MockServer
o Testing your API: MockMvc, strategies, building custom testing DSLs, testing authorization
o OpenAPI-freeze approval test
o Exercise: refactoring from a mock-based test to an end-to-end system test
o Optimizing run time of integration tests
o [optional] Consumer-Driven Contract Tests with Pact 1h
- Spring Batch [optional] 2-3h
o Concepts: Step, Job, Listener, Execution Context, Transaction control, Resume
o Using Listeners to track metadata
o Fine-Tuning Performance: Chunking, Parallel Steps, Multi-Threading processing
- Wrap-up:
o Real-life scenarios - Brainstorming
o Spring Overview: main features, strengths and weaknesses, best learning sources
Page 16 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
This workshop starts by reviewing the essential cryptography and web-security concepts and techniques.
The top web attacks identified by OWASP (https://owasp.org/) are then explained and fixed with Spring
Framework in several ways comparing the tradeoffs of each option. We’ll then dive into the two main
coordinates of security: authentication and authorization and we’ll explore the mainstream practices as
well as some advanced use-cases that will lead us to discover many details of the Spring Security
framework.
Prep-work:
- Read a bit in advance about the topics in the agenda that interest you the most. (request links)
- Watch Introduction to OAuth: https://www.youtube.com/watch?v=996OiexHze0
The agenda will be adapted for the technical stack / security techniques in use, ideally guided by the
client pen-testing findings.
Agenda
Page 18 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Code: https://github.com/victorrentea/jpa
Agenda:
- Chapter 1: Efficient Searching
o Lazy Loading: pitfalls and best practices
o N+1 Queries Problem + solutions; debate
o Paginated queries: pitfalls, best practices, UX Tricks
o Dynamic Queries with jpql+=, criteria, metamodel, specifications, fixed JPQL, and QueryDSL
o Tuning JPQL and SQL – practical hints
- Chapter 2: Designing a Clean, Performant Entity model
o Primitive links vs JPA links
o Persisting enums via Hibernate type mappers
o Bidirectional JPA Links – best practices
o Rich Deep Modeling using @Embeddables, ElementCollections and safe-guarding entities
o Advanced mapping: @MapsId, Composite PKs
o List<> vs Set<> of Children; implementing hashCode on Entities
- Chapter 3: Efficient Transactions
o Spring @Transactional: mechanics, propagation, error handling, after commit hooks
o Persistence Context as 1st Level Cache and Write Buffer (aka write-behind)
o Auto-flush dirty entities: embrace or reject?
o How to detect and avoid Connection Starvation issues
o Transaction management best practices
- Chapter 4: Batch Inserting
o Generating Primary Keys efficiently
Page 19 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o getReference()
o Batching inserts
o High-performance Spring Batch jobs – hands-on (on demand)
- Chapter 5: Caching (optional)
o Enabling Second-level Cache for Entities and Queries; tuning
o Comparison with Spring @Cacheable
- Chapter 6: Working with Large Files
o Domain modelling alternatives
o Streaming CLOB/BLOB data
- Chapter 7: Updating Entities
o Mastering .merge() operator
o Concurrency Control using optimistic and pessimistic locks
o [opt] Bulk update JPQL queries - pitfalls
Page 20 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
Prerequisites: Solid knowledge of the Java Language. Ideally: prior contact with performance issues.
Prep-work:
- CompletableFuture Workshop:
o Watch this introductory video: https://www.youtube.com/watch?v=PL_i--e9dow
o Solve the exercises on this project git
- Bring as many performance issues you encountered by now; ask your friends too for more.
- [optional] Install tools: VisualVM, Java Mission Control
- [optional] Study in advance heap-dumps of some memory leaks, available here
Code (please clone in advance):
- Profiling Project: https://github.com/victorrentea/performance-profiling
- Main Project: https://github.com/victorrentea/performance
Agenda:
- Introduction:
o War stories from participants
o Key Concepts, Metrics and Questions
o Principles and Strategies to improve Performance
o Typical bottlenecks of modern applications
- Multi-threading
o Thread Pools: mechanics, tuning parameters, typical usage scenarios
o Multi-threading Risks: race bugs, deadlocks, thread pool starvation
o [on request] Concurrency Primitives: Lock, Semaphore, CyclicBarrier, wait-notify
o Concurrency Control: ‘synchronized’, atomic primitives, synchronized+concurrent collections
o Exercise: Designing a thread-safe concurrent workflow
o Non-blocking concurrency with CompletableFutures, Reactive and Virtual Threads
o Spring support: ThreadPoolTaskExecutor, non-blocking HTTP Endpoints, @Async
o Exercise: parallelizing a non-blocking REST API
o Parallel streams: mechanics, best practices, pitfalls
Page 21 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o Load testing: principles and techniques
o Benchmarking with Gatling, jMeter, Java Measuring Harness
o JIT Compiler: mechanics, dynamic optimizations, writing JIT-friendly code
- Memory Management
o Java Memory Model: old/young, metaspace, TLAB
o Garbage Collector: Key concepts, Monitoring, GC Types
o Techniques for using less memory
o Thread Local data: best practices, propagation over thread pools, pitfalls
o Heap Dump analysis: retained/shallow heap, GC Roots, profiling allocations
o Exercise: Tracing ten types of Memory Leaks (some heapdumps are here)
- Caching [optional]
o Principles, cost-benefit-risk of caching, core parameters
o What & Where to cache data: comparison
o Maintaining cache consistency: eviction, TTL, distributed cache, best practices
Page 22 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
- Tuning JPA Performance 1-2 days (not included⚠️)
o Many Java applications are bottlenecked by the way they use JPA/Hibernate. On request, we
can include JPA (1-2 more days) – see the other topic in my agenda.
Overview:
The first challenge when approaching reactive programming is understanding WHY and WHEN NOT to
use it. Starting from ‘classic’ blocking web endpoints, we’ll benchmark the bottleneck that occurs under
heavy load and then explore the different historical alternatives to Reactor. Besides exploring dozens of
operators, the focus will remain on understanding the signals that drive all reactive flows, as this is the
key to unlocking the mysteries of backpressure, hot publishers and avoiding common pitfalls when
starting to work with Reactor. We will then use this knowledge to approach several typical reactive flows,
drawing conclusions about the best way to write the code to be maintainable and safe. After a roundtrip
of Spring WebFlux features and quirks, we’ll then talk about 2 tough tasks: testing reactive flows and
progressive migration of blocking code to reactive flows, and if there’s time left, about performance
tuning.
Prerequisites:
- Fluency with Functional Programming concepts: .filter() .map(), lambda syntax, immutable
objects
- Prior contact with multi-threaded code
Preparation:
⚠ This is a very challenging workshop ⚠
It’s imperative to allocate 2-8 hours to go through the prep work, alone or in pair programming (ask your
manager)
- The Main Workshop:
During the workshop, we will spend a lot of time solving some prepared problems (eg
C1_Creation.java) for which we’ll try to pass some pre-written unit tests (eg C1_CreationTest.java).
Please🙏 spend several hours on that code in advance to get more familiar with the concepts we’ll
be juggling with for long hard hours.
- Alternatively, check out the ProjectReactor’s official lite workshop with more explained theory is this
(est work time ≥ 3-4 hours): https://tech.io/playgrounds/929/reactive-programming-with-reactor-3/Intro
Page 23 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
- If you get stuck, you can find the solutions on our project’s Git ( eg: ‘Part01FluxSolved.java’ )
Code: https://github.com/victorrentea/reactive
Agenda
- Introduction
o [optional, basics] Recap: functional pipelines with Java8 Streams
o Blocking REST Endpoints: trace a thread pool starvation issue
o Alternatives to Reactive: CompletableFuture, coroutines(kt), Virtual Threads (Project Loom)
o Reactive Streams Spec
o Mono, Flux
o Understanding Marble Diagrams
o Signals: next, complete, error, request, subscribe, cancel
- Core Operators
o Immediate: just, empty, error, never, range, fromIterable
o Delayed: delay, interval, delayElements
o Immediate Operators: distinct, filter, map, first, take, contains, all
- Enriching Data
o flatMap vs concatMap vs flatMapSequential
o Batching requests: buffer, bufferWindow
o Handling Empty: defaultIfEmpty, switchIfEmpty
o Async filtering with.filterWhen
o Parallelizing work: Tuples, zip, zipWith, zipWhen
o Use-case Context design pattern
- Performing Side Effects
o Fire-and-forget using doOnNext
o Parallelization, cancellation
- [Hands-on] Migrating a blocking codebase to Reactive Programming
o Schedulers: CPU vs IO, best practices, ParallelFlux
o Calling blocking code in a safe way on boundedElastic scheduler
o CompletableFuture integration
o Bridging to a callback-based model: Sinks
o Reactive REST: Endpoints, and WebClient
o Reactive NoSQL: Mongo, Cassandra, Redis
o Reactive SQL: R2DBC
o Reactive Messages: send/receive
o Kafka Streams [optional]: KStream, KTable, Spring Cloud Stream Functions
- Infinite Fluxes
o Preventing cancellation with onErrorContinue
o GroupedFlux
o Time series operators: scan, reduce, window, buffer, sample, merge, concat, combineLatest
o Hot vs Cold Publisher
o In-memory broadcast using Sinks
o Caching Hot Publishers: replay, cache, connect, autoConnect
- Resilience
o Error handling patterns
o Timeout and Retry
Page 24 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
o Back-pressure
o Throttling: rate-limiting, resilience4j integration
o Challenges of distributed systems under heavy load - brainstorming
- Testing
o StepVerifier vs .block()
o TestPublisher
o PublisherProbe + custom extension
o Detecting blocking code with BlockHound
o Controlling Virtual Time [optional]
- Debugging, Monitoring and Tuning
o Propagating metadata via Reactor Context
o Checkpoints and Hooks.onOperatorDebug
o Monitoring using .metrics, .elapsed, .timed
- Common Pitfalls and Workarounds
o Not subscribing / Resubscribing to Cold Publisher
o Loosing Data Signals (empty)
o .subscribe()
o Blocking in non-blocking threads
o Unexpected Cancelation
- Review of Production Code from the audience
Note: discussing items out-of-order and skipping the basics will typically require a rather more experienced
audience.
Target Audience:
Important: The fee is per-hour and considerably lower than the one for a full-blown live training.
Page 25 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer
Full Training Offer – Victor Rentea victorrentea.ro
DATE:
TBD
FEE:
BASE FEE (per day) = <request a quote> EUR
Page 26 / 26 Get the most up-to-date version of this document at: https://victorrentea.ro/training-offer