Recent Posts
Archives

Posts Tagged ‘SpringIO2019’

PostHeaderIcon [SpringIO2019] Cloud Native Spring Boot Admin by Johannes Edmeier

At Spring I/O 2019 in Barcelona, Johannes Edmeier, a seasoned developer from Germany, captivated attendees with his deep dive into managing Spring Boot applications in Kubernetes environments using Spring Boot Admin. As the maintainer of this open-source project, Johannes shared practical insights into integrating Spring Boot Admin with Kubernetes via the Spring Cloud Kubernetes project. His session illuminated how developers can gain operational visibility and control without altering application code, making it a must-know tool for cloud-native ecosystems. This post explores Johannes’ approach, highlighting its relevance for modern DevOps.

Understanding Spring Boot Admin

Spring Boot Admin, a four-and-a-half-year-old project boasting over 17,000 GitHub stars, is an Apache-licensed tool designed to monitor and manage Spring Boot applications. Johannes, employed by ConSol, a German consultancy, dedicates 20% of his work time—and significant personal hours—to its development. The tool provides a user-friendly interface to visualize metrics, logs, and runtime configurations, addressing the limitations of basic monitoring solutions like plain metrics or logs. For Kubernetes-deployed applications, it leverages Spring Boot Actuator endpoints to deliver comprehensive insights without requiring code changes or new container images.

The challenge in cloud-native environments lies in achieving visibility into distributed systems. Johannes emphasized that Kubernetes, a common denominator across cloud vendors, demands robust monitoring tools. Spring Boot Admin meets this need by integrating with Spring Cloud Kubernetes, enabling service discovery and dynamic updates as services scale or fail. This synergy ensures developers can manage applications seamlessly, even in complex, dynamic clusters.

Setting Up Spring Boot Admin on Kubernetes

Configuring Spring Boot Admin for Kubernetes is straightforward, as Johannes demonstrated. Developers start by including the Spring Boot Admin starter server dependency, which bundles the UI and REST endpoints, and the Spring Cloud Kubernetes starter for service discovery. These dependencies, managed via Spring Cloud BOM, simplify setup. Johannes highlighted the importance of enabling the admin server, discovery client, and scheduling annotations in the application class to ensure health checks and service updates function correctly. A common pitfall, recently addressed in the documentation, is forgetting to enable scheduling, which prevents dynamic service updates.

For Kubernetes deployment, Johannes pre-built a Docker image and configured a service account with role-based access control (RBAC) to read pod, service, and endpoint data. This minimal RBAC setup avoids unnecessary permissions, enhancing security. An ingress and service complete the deployment, allowing access to the Spring Boot Admin UI. Johannes showcased a wallboard view, ideal for team dashboards, and demonstrated real-time monitoring by simulating a service failure, which triggered a yellow “restricted” status and subsequent recovery as Kubernetes rescheduled the pod.

Enhancing Monitoring with Actuator Endpoints

Spring Boot Admin’s power lies in its integration with Spring Boot Actuator, which exposes endpoints like health, info, metrics, and more. By default, only health and info endpoints are exposed, but Johannes showed how to expose all endpoints using a Kubernetes environment variable (management.endpoints.web.exposure.include=*). This unlocks detailed views for metrics, environment properties, beans, and scheduled tasks. For instance, the health endpoint provides granular details when set to “always” show details, revealing custom health indicators like database connectivity.

Johannes also highlighted advanced features, such as rendering Swagger UI links via the info endpoint’s properties, simplifying access to API documentation. For security, he recommended isolating Actuator endpoints on a separate management port (e.g., 9080) to prevent public exposure via the main ingress. Spring Cloud Kubernetes facilitates this by allowing developers to specify the management port for discovery, ensuring Spring Boot Admin accesses Actuator endpoints securely while keeping them hidden from external traffic.

Customization and Security Considerations

Spring Boot Admin excels in customization, catering to specific monitoring needs. Johannes demonstrated how to add top-level links to external tools like Grafana or Kibana, or embed them as iframes, reducing the need to memorize URLs. For advanced use cases, developers can create custom views using Vue.js, as Johannes did to toggle application status (e.g., setting a service to “out of service”). This flexibility extends to notifications, supporting Slack, Microsoft Teams, and email via simple configurations, with a test SMTP server like MailHog for demos.

Security is a critical concern, as Spring Boot Admin proxies requests to Actuator endpoints. Johannes cautioned against exposing the admin server publicly, citing an unsecured instance found via Google. He outlined three security approaches: no authentication (not recommended), session-based authentication with cookies, or OAuth2 with token forwarding, where the target application validates access. A service account handles background health checks, ensuring minimal permissions. For Keycloak integration, Johannes referenced a blog post by his colleague Tomas, showcasing Spring Boot Admin’s compatibility with modern security frameworks.

Runtime Management and Future Enhancements

Spring Boot Admin empowers runtime management, a standout feature Johannes showcased. The loggers endpoint allows dynamic adjustment of logging levels, with a forthcoming feature to set levels across all instances simultaneously. Other endpoints, like Jolokia for JMX interaction, enable runtime reconfiguration but require caution due to their power. Heap and thread dump endpoints aid debugging but risk exposing sensitive data or overwhelming resources. Johannes also previewed upcoming features, like minimum instance checks, enhancing Spring Boot Admin’s robustness in production.

For Johannes, Spring Boot Admin is more than a monitoring tool—it’s a platform for operational excellence. By integrating seamlessly with Kubernetes and Spring Boot Actuator, it addresses the complexities of cloud-native applications, empowering developers to focus on delivering value. His session at Spring I/O 2019 underscores its indispensable role in modern software ecosystems.

Links:

PostHeaderIcon [SpringIO2019] Zero Downtime Migrations with Spring Boot by Alex Soto

Deploying software updates without disrupting users is a cornerstone of modern DevOps practices. At Spring I/O 2019 in Barcelona, Alex Soto, a prominent figure at Red Hat, delivered a comprehensive session on achieving zero downtime migrations in Spring Boot applications, particularly within microservices architectures. With a focus on advanced deployment techniques and state management, Alex provided actionable insights for developers navigating the complexities of production environments. This post delves into his strategies, enriched with practical demonstrations and real-world applications.

The Evolution from Monoliths to Microservices

The shift from monolithic to microservices architectures has transformed deployment practices. Alex began by contrasting the simplicity of monolithic deployments—where a single application could be updated during off-hours with minimal disruption—with the complexity of microservices. In a microservices ecosystem, services are interconnected in a graph-like structure, often with independent databases and multiple entry points. This distributed nature amplifies the impact of downtime, as a single service failure can cascade across the system.

To address this, Alex emphasized the distinction between deployment (placing a service in production) and release (routing traffic to it). This separation is critical for zero downtime, allowing teams to test new versions without affecting users. By leveraging service meshes like Istio, developers can manage traffic routing dynamically, ensuring seamless transitions between service versions.

Blue-Green and Canary Deployments

Alex explored two foundational techniques for zero downtime: blue-green and canary deployments. In blue-green deployments, a new version (green) is deployed alongside the existing one (blue), with traffic switched to the green version once validated. This approach minimizes disruption but risks affecting all users if the green version fails. Canary deployments mitigate this by gradually routing a small percentage of traffic to the new version, allowing teams to monitor performance before a full rollout.

Both techniques rely on robust monitoring, such as Prometheus, to detect issues early. Alex demonstrated a blue-green deployment using a movie store application, where a shopping cart’s state was preserved across versions using an in-memory data grid like Redis. This ensured users experienced no loss of data, even during version switches, highlighting the power of stateless and ephemeral state management in microservices.

Managing Persistent State

Persistent state, such as database schemas, poses a significant challenge in zero downtime migrations. Alex illustrated this with a scenario involving renaming a database column from “name” to “full_name.” A naive approach risks breaking compatibility, as some users may access the old schema while others hit the new one. To address this, he proposed a three-step migration process:

  1. Dual-Write Phase: The application writes to both the old and new columns, ensuring data consistency across versions.
  2. Data Migration: Historical data is copied from the old column to the new one, often using tools like Spring Batch to avoid locking the database.
  3. Final Transition: The application reads and writes exclusively to the new column, with the old column retained for rollback compatibility.

This methodical approach, demonstrated with a Kubernetes-based cluster, ensures backward compatibility and uninterrupted service. Alex’s demo showed how Istio’s traffic management capabilities, such as routing rules and mirroring, facilitate these migrations by directing traffic to specific versions without user impact.

Leveraging Istio for Traffic Management

Istio, a service mesh, plays a pivotal role in Alex’s strategy. By abstracting cross-cutting concerns like service discovery, circuit breaking, and security, Istio simplifies zero downtime deployments. Alex showcased how Istio’s sidecar containers handle traffic routing, enabling techniques like traffic mirroring for dark launches. In a dark launch, requests are sent to both old and new service versions, but only the old version’s response is returned to users, allowing teams to test new versions in production without risk.

Istio also supports chaos engineering, simulating delays or timeouts to test resilience. Alex cautioned, however, that such practices require careful communication to avoid unexpected disruptions, as illustrated by anecdotes of misaligned testing efforts. By integrating Istio with Spring Boot, developers can achieve robust, scalable deployments with minimal overhead.

Handling Stateful Services

Stateful services, particularly those with databases, require special attention. Alex addressed the challenge of maintaining ephemeral state, like shopping carts, using in-memory data grids. For persistent state, he recommended strategies like synthetic transactions or throwaway database clusters to handle mirrored traffic during testing. These approaches prevent unintended database writes, ensuring data integrity during migrations.

In his demo, Alex applied these principles to a movie store application, showing how a shopping cart persisted across blue-green deployments. By using Redis to replicate state across a cluster, he ensured users retained their cart contents, even as services switched versions. This practical example underscored the importance of aligning infrastructure with business needs.

Lessons for Modern DevOps

Alex’s presentation offers a roadmap for achieving zero downtime in microservices. By combining advanced deployment techniques, service meshes, and careful state management, developers can deliver reliable, user-focused applications. His emphasis on tools like Istio and Redis, coupled with a disciplined migration process, provides a blueprint for tackling real-world challenges. For teams like those at Red Hat, these strategies enable faster, safer releases, aligning technical excellence with business continuity.

Links:

PostHeaderIcon [SpringIO2019] Managing Business Processes in Microservice Architecture with Spring Ecosystem by Bartłomiej Słota

In the dynamic landscape of software development, reconciling the structured demands of Business Process Management (BPM) with the flexibility of microservices presents both challenges and opportunities. At Spring I/O 2019 in Barcelona, Bartłomiej Słota, a seasoned consultant from Poland, delivered an insightful presentation on integrating BPM with microservices using the Spring ecosystem. Drawing from his experience at Batcave IT Minds and his work with Vattenfall, a Swedish energy company, Bartłomiej offered a compelling narrative on achieving autonomy and efficiency in business processes. This post explores his approach, emphasizing practical solutions for modern software architectures.

The Business Process Management Challenge

Business Process Management systems are pivotal for organizations aiming to streamline operations and enhance competitiveness. With a market valued at $8 billion and projected to reach $18.5 billion by 2025, companies invest heavily in BPM to optimize workflows and reduce costs. However, traditional BPM solutions often rely on monolithic architectures, which clash with the agile, decentralized nature of microservices. Bartłomiej introduced a fictional developer, Bruce, who faces the frustration of rigid systems, manual interventions, and low productivity. Bruce’s struggle mirrors real-world challenges where teams grapple with aligning business needs with technical agility.

The core issue lies in the inherent tension between the centralized control of BPM systems and the autonomy required for microservices. Traditional BPM architectures lack scalability, technology flexibility, and deployment independence, leading to inefficiencies. Bartłomiej proposed a solution: leveraging microservices to create autonomous, scalable, and resilient business processes, supported by tools like Apache Kafka and Spring Cloud Stream.

Achieving Autonomy Through Microservices

Microservices thrive on autonomy, which Bartłomiej described as a multidimensional vector encompassing scalability, deployment, data management, resilience, technology choice, and team dynamics. Scalability, for instance, extends beyond technical resources to organizational efficiency. Drawing from Robert C. Martin’s Clean Architecture, Bartłomiej highlighted how unchecked complexity can inflate development costs, with more engineers producing fewer lines of business logic per release. Microservices address this by allowing independent scaling of components, reducing organizational bottlenecks.

Deployment autonomy is equally critical. By decoupling services, teams can deploy updates independently, avoiding the all-or-nothing approach of monolithic systems. Bartłomiej emphasized high cohesion, ensuring each microservice focuses on specific business functionalities. This approach also extends to data management, where each service maintains its own database, enhancing autonomy and reducing dependencies. For Bruce, this meant breaking free from the constraints of a shared, generic database schema, enabling faster and safer changes.

Event Storming for Business Alignment

To bridge the gap between business and technical teams, Bartłomiej advocated for event storming, a collaborative workshop method that fosters a shared understanding of business processes. Unlike traditional BPMN diagrams, which may alienate non-technical stakeholders, event storming uses sticky notes to map processes in a way that’s accessible to all. Through a case study of an address change process, Bartłomiej demonstrated how event storming identifies key events—like authorization or AML checks—revealing inefficiencies and silos. This process helped Bruce’s team define clear bounded contexts, ensuring microservices remain cohesive and autonomous.

Event storming also mitigates the risks of Conway’s Law, where system design mirrors organizational communication patterns. By engaging stakeholders from various departments, teams can uncover where value is created or lost, aligning technical solutions with business goals. For Vattenfall, this approach facilitated the migration of their mobility platform to a Kubernetes-based microservice environment, enhancing scalability and user experience.

Orchestration and Spring Ecosystem Tools

Bartłomiej contrasted two communication patterns for microservices: choreography and orchestration. Choreography, where services emit and consume events independently, can lead to tight coupling when new processes are introduced. Instead, he recommended orchestration, where a dedicated process orchestrator manages workflows by sending commands and processing events. In the address change example, an orchestrator coordinates interactions between services like authorization, customer contact, and AML checks, ensuring flexibility and resilience.

Spring Cloud Stream and Apache Kafka play pivotal roles in this architecture. Spring Cloud Stream abstracts messaging complexities, enabling seamless communication via Kafka topics. Kafka’s consumer groups and topic partitioning enhance scalability, while Kafka Streams supports real-time data processing for tasks and reports. Bartłomiej showcased how Vattenfall uses Kafka Streams to build read models, offering business insights that surpass traditional BPM solutions. Additionally, tools like Spring Cloud Sleuth and Spring Cloud Contract ensure observability and reliable testing, critical for maintaining autonomous services.

Empowering Teams and Technology Choices

The success of microservices hinges on people. Bartłomiej stressed that organizational culture must empower teams to own processes end-to-end, fostering leadership and accountability. By assigning a single team to each business process, as identified through event storming, companies can minimize conflicts and enhance autonomy. This approach also allows teams to select technologies suited to their specific challenges, from Spring Data REST for lightweight APIs to Akka for complex workflows.

For Bruce, adopting these principles transformed his project. By embracing microservices, event storming, and Spring ecosystem tools, he addressed pain points, improved productivity, and aligned technical efforts with business value. Bartłomiej’s presentation underscores that integrating BPM with microservices is not just a technical endeavor but a cultural shift, enabling organizations to deliver competitive, scalable solutions.

Links:

PostHeaderIcon [SpringIO2019] Spring I/O 2019 Keynote: Spring Framework 5.2, Reactive Programming, Kotlin, and Coroutines

The Spring I/O 2019 Keynote, featuring Juergen Hoeller, Ben Hale, Violeta Georgieva, and Sébastien Deleuze, offered a comprehensive overview of the latest developments and future directions within the Spring ecosystem. The keynote covered significant themes, including the advancements in Spring Framework 5.2, enhancements in Reactive programming, and the growing importance of Kotlin and coroutines in Spring applications.

The keynote served as a crucial update for the Spring community, highlighting how the framework continues to evolve to meet modern application development needs, from high-performance reactive systems to seamless integration with modern languages like Kotlin.

Spring Framework 5.2 Themes

Juergen Hoeller, co-founder and project lead of the Spring Framework, presented the key themes for Spring Framework 5.2. These themes focused on refining existing capabilities and introducing new features to enhance developer experience and application performance. While specific details were covered, the overarching goal was to continue Spring’s tradition of providing a robust and flexible foundation for enterprise applications.

Improvements to Reactive: Core/UX, R2DBC, RSocket

Ben Hale and Violeta Georgieva discussed the ongoing advancements in Reactive programming within the Spring ecosystem. They highlighted improvements to the core Reactive capabilities, focusing on enhancing user experience (UX) and developer productivity. The session also delved into R2DBC (Reactive Relational Database Connectivity), a specification for reactive programming with relational databases, and RSocket, an application-level protocol for reactive stream communication. These developments underscore Spring’s commitment to building highly scalable and responsive applications.

Kotlin and Coroutines

Sébastien Deleuze focused on the deepening integration of Kotlin and coroutines within Spring. Kotlin’s concise syntax and functional programming features, combined with the power of coroutines for asynchronous programming, offer significant benefits for modern Spring applications. Deleuze demonstrated how these technologies enable developers to write more expressive, performant, and maintainable code, further solidifying Kotlin as a first-class language for Spring development.

The Evolution of the Spring Ecosystem

The keynote collectively showcased Spring’s continuous evolution, driven by innovation and community feedback. The speakers emphasized how Spring is adapting to new paradigms in software development, such as reactive programming and multi-language support, while maintaining its core principles of productivity and flexibility. The discussions provided a roadmap for developers to leverage the latest features and best practices for building next-generation applications.

Conclusion

The Spring I/O 2019 Keynote offered a compelling vision for the future of Spring, demonstrating its adaptability and continued relevance in the rapidly changing landscape of software development. Attendees gained valuable insights into key areas of focus and practical applications of the latest Spring technologies.

PostHeaderIcon [SpringIO2019] Event Driven Microservices with Axon and Spring Boot: Excitingly Boring

Simplifying Complex Architectures with Axon and Spring Boot

In his Spring I/O 2019 presentation, Allard Buijze, founder and CTO of AxonIQ, demonstrates how to build and scale event-driven microservices with Axon Framework and Spring Boot, making the process “excitingly boring” due to its simplicity. Buijze addresses the common misconception that microservices, especially event-driven variants, require complex and hard-to-grasp technologies, often diverting focus from core business logic to integration challenges.

The talk highlights the synergy between Spring Boot’s powerful autoconfiguration capabilities and Axon Framework’s support for Command Query Responsibility Segregation (CQRS) and Event Sourcing (ES). Through live coding, Buijze illustrates how this combination trivializes the development of scalable event-driven applications. Axon Framework, an open-source Java framework created by Buijze, is designed to help developers build scalable and maintainable applications using a message-driven approach, simplifying the complexities inherent in distributed systems.

Key takeaways from this session include:

  • Trivializing Event-Driven Microservices: Leveraging Spring Boot and Axon to simplify the architecture and development of microservices.
  • CQRS and Event Sourcing in Practice: Understanding how Axon Framework provides the necessary building blocks for these patterns.
  • Message-Driven Architecture: Components communicate via commands, events, and queries, promoting loose coupling and flexibility.
  • Scalability and Maintainability: Designing systems that are easy to extend and manage over time.
  • Focus on Business Logic: Shifting developer attention from infrastructure concerns to core business requirements.

Allard Buijze has extensive experience in designing and developing enterprise applications with a strong focus on scalability and performance. He is a recognized expert in Domain-Driven Design (DDD) and CQRS, and regularly shares his insights at conferences and workshops.

Links

PostHeaderIcon [SpringIO2019] Boot Loot: Level Up Your Spring Game Like the Pros

Mastering Spring Boot Customization and Configuration

In his Spring I/O 2019 presentation, Joris Kuipers dives deep into the advanced capabilities of Spring Boot, extending beyond its familiar features like autoconfiguration and actuator support. He explores how developers can truly “level up their game” by leveraging custom autoconfiguration and type-safe configuration classes. Kuipers provides practical insights into customizing RestTemplates while ensuring that instrumentation from Boot and Cloud remains intact. The talk also covers strategies for reducing the cardinality of Boot-provided metrics and defining custom ones, as well as handling the migration of older Spring applications to Boot, including considerations for external directories on the classpath.

Throughout this fast-paced session, Joris Kuipers shares a wealth of tips, tricks, and best practices gleaned from his extensive experience with Spring Boot and Cloud in diverse production environments. Whether you’re new to Spring Boot or a seasoned user, this presentation offers hands-on techniques that can be immediately applied to your projects. Key topics include:

  • Custom Autoconfiguration and Type-Safe Configuration: Moving beyond basic configurations to create robust and maintainable applications.
  • RestTemplate Customization: Ensuring proper instrumentation and integration within Spring Boot and Cloud ecosystems.
  • Advanced Metrics Management: Reducing cardinality and defining custom metrics for better observability.
  • Migrating Legacy Spring Applications: Practical approaches to integrate older applications with the Spring Boot environment.
  • Error Handling and Validation: Best practices for managing default error pages and implementing effective bean validation.

Joris Kuipers has been building enterprise Java applications for 25 years and has previously served as a trainer and consultant for SpringSource, continuing to teach Spring training for the Trifork Academy.

Links