Archive for the ‘General’ Category
[Devoxx FR 2024] Instrumenting Java Applications with OpenTelemetry: A Comprehensive Guide
Introduction
In a recent presentation at a Paris JUG event, Bruce Bujon, an R&D Engineer at Datadog and an open-source developer, delivered an insightful talk on instrumenting Java applications with OpenTelemetry. This powerful observability framework is transforming how developers monitor and analyze application performance, infrastructure, and security. In this detailed post, we’ll explore the key concepts from Bruce’s presentation, breaking down OpenTelemetry, its components, and practical steps to implement it in Java applications.
What is OpenTelemetry?
OpenTelemetry is an open-source observability framework designed to collect, process, and export telemetry data in a vendor-agnostic manner. It captures data from various sources—such as virtual machines, databases, and applications—and exports it to observability backends for analysis. Importantly, OpenTelemetry focuses solely on data collection and management, leaving visualization and analysis to backend tools like Datadog, Jaeger, or Grafana.
The framework supports three primary signals:
- Traces: These map the journey of requests through an application, highlighting the time taken by each component or microservice.
- Logs: Timestamped events, such as user actions or system errors, familiar to most developers.
- Metrics: Aggregated numerical data, like request rates, error counts, or CPU usage over time.
In his talk, Bruce focused on traces, which are particularly valuable for understanding performance bottlenecks in distributed systems.
Why Use OpenTelemetry for Java Applications?
For Java developers, OpenTelemetry offers a standardized way to instrument applications, ensuring compatibility with various observability backends. Its flexibility allows developers to collect telemetry data without being tied to a specific tool, making it ideal for diverse tech stacks. Bruce highlighted its growing adoption, noting that OpenTelemetry is the second most active project in the Cloud Native Computing Foundation (CNCF), behind only Kubernetes.
Instrumenting a Java Application: A Step-by-Step Guide
Bruce demonstrated three approaches to instrumenting Java applications with OpenTelemetry, using a simple example of two web services: an “Order” service and a “Storage” service. The goal was to trace a request from the Order service, which calls the Storage service to check stock levels for items like hats, bags, and socks.
Approach 1: Manual Instrumentation with OpenTelemetry API and SDK
The first approach involves manually instrumenting the application using the OpenTelemetry API and SDK. This method offers maximum control but requires significant development effort.
Steps:
- Add Dependencies: Include the OpenTelemetry Bill of Materials (BOM) to manage library versions, along with the API, SDK, OTLP exporter, and semantic conventions.
- Initialize the SDK: Set up a
TracerProviderwith a resource defining the service (e.g., “storage”) and attributes like service name and deployment environment. - Create a Tracer: Use the
Tracerto generate spans for specific operations, such as a web route or internal method. - Instrument Routes: For each route or method, create a span using a
SpanBuilder, set attributes (e.g., span kind as “server”), and mark the start and end of the span. - Export Data: Configure the SDK to export spans to an OpenTelemetry Collector via the OTLP protocol.
Example Output: Bruce showed a trace with two spans—one for the route and one for an internal method—displayed in Datadog’s APM view, with attributes like service name and HTTP method.
Pros: Fine-grained control over instrumentation.
Cons: Verbose and time-consuming, especially for large applications or libraries with private APIs.
Approach 2: Framework Support with Spring Boot
The second approach leverages framework-specific integrations, such as Spring Boot’s OpenTelemetry starter, to automate instrumentation.
Steps:
- Add Spring Boot Starter: Include the OpenTelemetry starter, which bundles the API, SDK, exporter, and autoconfigure dependencies.
- Configure Environment Variables: Set variables for the service name, OTLP endpoint, and other settings.
- Run the Application: The starter automatically instruments web routes, capturing HTTP methods, routes, and response codes.
Example Output: Bruce demonstrated a trace for the Order service, with spans automatically generated for routes and tagged with HTTP metadata.
Pros: Minimal code changes and good generic instrumentation.
Cons: Limited customization and varying support across frameworks (e.g., Spring Boot doesn’t support JDBC out of the box).
Approach 3: Auto-Instrumentation with JVM Agent
The third and most powerful approach uses the OpenTelemetry JVM agent for automatic instrumentation, requiring minimal code changes.
Steps:
- Add the JVM Agent: Attach the OpenTelemetry Java agent to the JVM using a command-line option (e.g.,
-javaagent:opentelemetry-javaagent.jar). - Configure Environment Variables: Use autoconfigure variables (around 80 options) to customize the agent’s behavior.
- Remove Manual Instrumentation: Eliminate SDK, exporter, and framework dependencies, keeping only the API and semantic conventions for custom instrumentation.
- Run the Application: The agent instruments web servers, clients, and libraries (e.g., JDBC, Kafka) at runtime.
Example Output: Bruce showcased a complete distributed trace, including spans for both services, web clients, and servers, with context propagation handled automatically.
Pros: Comprehensive instrumentation with minimal effort, supporting over 100 libraries.
Cons: Potential conflicts with other JVM agents (e.g., security tools) and limited support for native images (e.g., Quarkus).
Context Propagation: Linking Traces Across Services
A critical aspect of distributed tracing is context propagation, ensuring that spans from different services are linked within a single trace. Bruce explained that without propagation, the Order and Storage services generated separate traces.
To address this, OpenTelemetry uses HTTP headers (e.g., W3C’s traceparent and tracestate) to carry tracing context. In the manual approach, Bruce implemented a RestTemplate interceptor in Spring to inject headers and a Quarkus filter to extract them. The JVM agent, however, handles this automatically, simplifying the process.
Additional Considerations
- Baggage: In response to an audience question, Bruce clarified that OpenTelemetry’s baggage feature allows propagating business-specific metadata across services, complementing tracing context.
- Cloud-Native Support: While cloud providers like AWS Lambda have proprietary monitoring solutions, their native support for OpenTelemetry varies. Bruce suggested further exploration for specific use cases like batch jobs or serverless functions.
- Performance: The JVM agent modifies bytecode at runtime, which may impact startup time but generally has negligible runtime overhead.
Conclusion
OpenTelemetry is a game-changer for Java developers seeking to enhance application observability. As Bruce demonstrated, it offers three flexible approaches—manual instrumentation, framework support, and auto-instrumentation—catering to different needs and expertise levels. The JVM agent stands out for its ease of use and comprehensive coverage, making it an excellent starting point for teams new to OpenTelemetry.
To get started, add the OpenTelemetry Java agent to your application with a single command-line option and configure it via environment variables. This minimal setup allows you to immediately observe your application’s behavior and assess OpenTelemetry’s value for your team.
The code and slides from Bruce’s presentation are available on GitHub, providing a practical reference for implementing OpenTelemetry in your projects. Whether you’re monitoring microservices or monoliths, OpenTelemetry empowers you to gain deep insights into your applications’ performance and behavior.
Resources
[PHPForumParis2023] Streams: We All Underestimate Predis! – Alexandre Daubois
Alexandre Daubois, lead Symfony developer at Wanadev Digital, delivered a concise yet impactful session at Forum PHP 2023, spotlighting the power of Predis, a PHP client for Redis. Focusing on his team’s work at Wanadev Digital, Alexandre shared how Predis’s stream capabilities resolved critical performance issues in their 3D home modeling tool, Kozikaza. His talk highlighted practical applications of Redis streams, inspiring developers to leverage this underutilized tool for efficient data handling.
The Power of Redis Streams
Alexandre introduced Redis streams as a lightweight, in-memory data structure ideal for handling large datasets. At Wanadev Digital, the Kozikaza platform, which enables users to design 3D home models in browsers, faced challenges with storing and processing large JSON models. Alexandre explained how Predis’s stream functionality allowed his team to write data incrementally to cloud storage, avoiding memory bottlenecks. This approach enabled Kozikaza to handle massive datasets, such as 50GB JSON files, efficiently.
Solving Real-World Challenges
Detailing the implementation, Alexandre described how Predis’s Lazy Stream feature facilitated piecewise data writing to cloud buckets, resolving memory constraints in Kozikaza’s workflow. He shared user behavior insights, noting that long session times (up to six hours) made initial load times less critical, as users kept the application open. This context allowed Alexandre’s team to prioritize functionality over premature optimization, using Predis to deliver a robust solution under tight deadlines.
Links:
[KotlinConf2023] Transforming Farmers’ Lives in Kenya: Apollo Agriculture’s Android Apps with Harun Wangereka
Harun Wangereka, a Software Engineer at Apollo Agriculture and a Google Developer Expert for Android, delivered an inspiring presentation at KotlinConf’23 about how his company is leveraging Android technology to change the lives of farmers in Kenya. His talk detailed Apollo Agriculture’s two core Android applications, built entirely in Kotlin, which are offline-first and utilize server-driven UI (SDUI) with Jetpack Compose to cater to the unique challenges of their user base. Harun is also active in Droidcon Kenya.
Apollo Agriculture’s mission is to empower small-scale farmers by bundling financing, high-quality farm inputs, agronomic advice, insurance, and market access. Their tech-based approach uses satellite data and machine learning for credit decisions and automated operations to maintain low costs and scalability. The customer journey involves signup via agents or SMS/USSD, kyc data collection (including GPS farm outlines), automated credit decisions (often within minutes), input pickup from agro-dealers, digital advice via voice trainings, and loan repayment post-harvest.
Addressing Unique Challenges in the Kenyan Context
Harun highlighted several critical challenges that shaped their app development strategy:
* Low-Memory Devices: Many agents and farmers use entry-level Android devices with limited RAM and storage. The apps need to be lightweight and performant.
* Low/Intermittent Internet Bandwidth: Internet connectivity can be unreliable and expensive. An offline-first approach is crucial, allowing agents to perform tasks without constant internet access and sync data later.
* Diverse User Needs and Rapid Iteration: The agricultural domain requires frequent updates to forms, workflows, and information provided to farmers and agents. A flexible UI system that can be updated without frequent app releases is essential.
These challenges led Apollo Agriculture to adopt a server-driven UI (SDUI) approach. Initially implemented with Anko (a deprecated Kotlin library for Android UI), they later rewrote this system entirely using Jetpack Compose.
Server-Driven UI with Jetpack Compose
The core of their SDUI system relies on JSON responses from the server that define the UI components, their properties, validations, and conditional logic.
Key aspects of their implementation include:
* Task-Based Structure: The app presents tasks to agents (e.g., onboarding a farmer, collecting survey data). Each task is represented by a JSON schema from the server.
* Dynamic Form Rendering: The JSON schema defines various UI elements like text inputs, number inputs, date pickers, location pickers (with map integration for capturing farm boundaries), image inputs (with compression), and more. These are dynamically rendered using Jetpack Compose.
* Stateful Composable Components: Harun detailed their approach to building stateful UI components in Compose. Each question or input field manages its own state (value, errors, visibility) using remember and mutableStateOf. Validation logic (e.g., required fields, min/max length) is also defined in the JSON and applied dynamically.
* Triggers and Conditionals: The JSON schema supports triggers (e.g., “on save”) and complex conditional logic using an internal tool called “Choice Expressions” and an implementation of JSON Schema. This allows UI elements or entire sections to be shown/hidden or enabled/disabled based on user input or other conditions, enabling dynamic and context-aware forms.
* Offline First: Task schemas and user data are stored locally, allowing full offline functionality. Data is synced with the server when connectivity is available.
* Testing: They extensively test their dynamic UI components and state logic in isolation, verifying state changes, validation behavior, and conditional rendering.
Harun shared examples of the JSON structure for defining UI elements, properties (like labels, hints, input types), validators, and conditional expressions. He walked through how a simple text input composable would manage its state, handle user input, and apply validation rules based on the server-provided schema.
Learnings and Future Considerations
The journey involved migrating from Anko to Jetpack Compose for their SDUI renderer, which Compose’s reactive DSL made more manageable and maintainable. They found Compose to be well-suited for building dynamic, stateful UIs.
Challenges encountered included handling keyboard interactions smoothly with scrolling content and managing the complexity of deeply nested conditional UIs.
When asked about open-sourcing their powerful form-rendering engine, Harun mentioned it’s a possibility they are considering, as the core logic is already modularized, and community input could be valuable. He also noted that while some pricing information is dynamic (e.g., based on farm size), they try to standardize core package prices to avoid confusion for farmers.
Harun Wangereka’s talk provided a compelling case study of how Kotlin and Jetpack Compose can be used to build sophisticated, resilient, and impactful Android applications that address real-world challenges in demanding environments.
Links:
[PHPForumParis2023] Open/Closed Principle: Extend, Don’t Extends! – Thomas Dutrion
Thomas Dutrion, CTO and a passionate advocate for clean code, presented an engaging session at Forum PHP 2023 on the Open/Closed Principle, a cornerstone of the SOLID principles. With a playful nod to avoiding PHP’s extends keyword, Thomas clarified how to design extensible systems without relying on inheritance. His talk, infused with practical examples and a call for team collaboration, offered PHP developers a clear framework for building flexible, maintainable codebases.
Demystifying the Open/Closed Principle
Thomas began by explaining the Open/Closed Principle, which states that software entities should be open for extension but closed for modification. He emphasized that this principle enables developers to add new functionality without altering existing code, reducing the risk of introducing bugs. Using relatable analogies, Thomas distinguished between “extending” a system’s behavior through design patterns and the pitfalls of using PHP’s extends for inheritance, which can lead to rigid, tightly coupled code.
Practical Techniques for Extension
Delving into implementation, Thomas showcased techniques like decorators and callbacks to achieve extensibility. He provided examples of middleware patterns, such as those defined in PSR-15, where request handlers are passed through a stack of processes, allowing behavior to be extended dynamically. Thomas cautioned against overly complex callback chains, advocating for clear, team-aligned designs. His demonstrations highlighted how these patterns maintain code stability while allowing for seamless enhancements.
Team Collaboration and Clarity
Concluding his talk, Thomas stressed the importance of team agreement when applying the Open/Closed Principle. He noted that patterns like decorators often rely on dependency injection, which can obscure implementation details unless well-documented. By advocating for clear communication and tools like event dispatchers, Thomas inspired developers to work collaboratively, ensuring extensible designs are both effective and understandable within their teams.
[KotlinConf2023] KotlinConf’23 Closing Panel: Community Questions and Future Insights
KotlinConf’23 concluded with its traditional Closing Panel, an open forum where attendees could pose their burning questions to a diverse group of experts from the Kotlin community, including key figures from JetBrains and Google. The panel, moderated by Hadi Hariri, featured prominent names such as Roman Elizarov, Egor Tolstoy, Maxim Shafirov (CEO of JetBrains), Svetlana Isakova, Pamela Hill, Sebastian Aigner (all JetBrains), Grace Kloba, Kevin Galligan, David Blanc, Wenbo, Jeffrey van Gogh (all Google), Jake Wharton (Cash App), and Zac Sweers (Slack), among others.
The session was lively, covering a wide range of topics from language features and tooling to ecosystem development and the future of Kotlin across different platforms.
Kotlin’s Ambitions and Language Evolution
One of the initial questions addressed Kotlin’s overarching goal, humorously framed as whether Kotlin aims to “get rid of other programming languages”. Roman Elizarov quipped they only want to get rid of “bad ones,” while Egor Tolstoy clarified that Kotlin’s focus is primarily on application development (services, desktop, web, mobile) rather than systems programming.
Regarding Kotlin 2.0 and the possibility of removing features, the panel indicated a strong preference for maintaining backward compatibility. However, if a feature were to be considered for removal, it would likely be something with a clearly superior alternative, such as potentially older ways of doing things if newer, more robust mechanisms (like K2 compiler plugins replacing older KAPT mechanisms, hypothetically) became the standard. The discussion also touched on the desire for a unified, official Kotlin style guide and formatter to reduce community fragmentation around tooling, though Zac Sweers noted that even with an official tool, community alternatives would likely persist.
Multiplatform, Compose, and Ecosystem
A significant portion of the Q&A revolved around Kotlin Multiplatform (KMP) and Compose Multiplatform.
* Dart Interoperability: Questions arose about interoperability between Kotlin/Native (especially for Compose on iOS which uses Skia) and Dart/Flutter. While direct, deep interoperability wasn’t presented as a primary focus, the general sentiment was that both ecosystems are strong, and developers choose based on their needs. The panel emphasized that Compose for iOS aims for a native feel and deep integration with iOS platform features.
* Compose UI for iOS and Material Design: A recurring concern was whether Compose UI on iOS would feel “too Material Design” and not native enough for iOS users. Panelists from JetBrains and Google acknowledged this, stressing ongoing efforts to ensure Compose components on iOS adhere to Cupertino (iOS native) design principles and feel natural on the platform. Jake Wharton added that making Kotlin APIs feel idiomatic to iOS developers is crucial for adoption.
* Future of KMP: The panel expressed strong optimism for KMP’s future, highlighting its stability and growing library support. They see KMP becoming the default way to build applications when targeting multiple platforms with Kotlin. The focus is on making KMP robust and ensuring a great developer experience across all supported targets.
Performance, Tooling, and Emerging Areas
- Build Times: Concerns about Kotlin/Native build times, especially for iOS, were acknowledged. The team is continuously working on improving compiler performance and reducing build times, with K2 expected to bring further optimizations.
- Project Loom and Coroutines: Roman Elizarov reiterated points from his earlier talk, stating that Loom is excellent for migrating existing blocking Java code, while Kotlin Coroutines offer finer-grained control and structured concurrency, especially beneficial for UI and complex asynchronous workflows. They are not mutually exclusive and can coexist.
- Kotlin in Gaming: While not a primary focus historically, the panel acknowledged growing interest and some community libraries for game development with Kotlin. The potential for KMP in this area was also noted.
- Documentation: The importance of clear, comprehensive, and up-to-date documentation was a recurring theme, with the panel acknowledging it as an ongoing effort.
- AI and Kotlin: When asked about AI taking developers’ jobs, Zac Sweers offered a pragmatic take: AI won’t take your job, but someone who knows how to use AI effectively might. The panel highlighted that Kotlin is well-suited for building AI tools and applications.
The panel concluded with the exciting reveal of Kotlin’s reimagined mascot, Kodee (spelled K-O-D-E-E), a cute, modern character designed to represent the language and its community. Pins of Kodee were made available to attendees, adding a fun, tangible takeaway to the conference’s close.
Links:
[DevoxxBE2023] How Sand and Java Create the World’s Most Powerful Chips
Johan Janssen, an architect at ASML, captivated the DevoxxBE2023 audience with a deep dive into the intricate process of chip manufacturing and the role of Java in optimizing it. Johan, a seasoned speaker and JavaOne Rock Star, explained how ASML’s advanced lithography machines, powered by Java-based software, enable the creation of cutting-edge computer chips used in devices worldwide.
From Sand to Silicon Wafers
Johan began by demystifying chip production, starting with silica sand, an abundant resource transformed into silicon ingots and sliced into wafers. These wafers, approximately 30 cm in diameter, serve as the foundation for chips, hosting up to 600 chips per wafer or thousands for smaller sensors. He passed around a wafer adorned with Java’s mascot, Duke, illustrating the physical substrate of modern electronics.
The process involves printing multiple layers—up to 200—onto wafers using extreme ultraviolet (EUV) lithography machines. These machines, requiring four Boeing 747s for transport, achieve precision at the nanometer scale, with transistors as small as three nanometers. Johan likened this to driving a car 300 km and retracing the path with only 2 mm deviation, highlighting the extraordinary accuracy required.
The Role of EUV Lithography
Johan detailed the EUV lithography process, where tin droplets are hit by a 40-kilowatt laser to generate plasma at sun-like temperatures, producing EUV light. This light, directed by ultra-flat mirrors, patterns wafers through reticles costing €250,000 each. The process demands cleanroom environments, as even a single dust particle can ruin a chip, and involves continuous calibration to maintain precision across thousands of parameters.
ASML’s machines, some over 30 years old, remain in use for producing sensors and less advanced chips, demonstrating their longevity. Johan also previewed future advancements, such as high numerical aperture (NA) machines, which will enable even smaller transistors, further enhancing chip performance and energy efficiency.
Java-Powered Analytics Platform
At the heart of Johan’s talk was ASML’s Java-based analytics platform, which processes 31 terabytes of data weekly to optimize chip production. Built on Apache Spark, the platform distributes computations across worker nodes, supporting plugins for data ingestion, UI customization, and processing. These plugins allow departments to integrate diverse data types, from images to raw measurements, and support languages like Julia and C alongside Java.
The platform, running on-premise to protect sensitive data, consolidates previously disparate applications, improving efficiency and user experience. Johan highlighted a machine learning use case where the platform increased defect detection from 70% to 92% without slowing production, showcasing Java’s role in handling complex computations.
Challenges and Solutions in Chip Manufacturing
Johan discussed challenges like layer misalignment, which can cause short circuits or defective chips. The platform addresses these by analyzing wafer plots to identify correctable errors, such as adjusting subsequent layers to compensate for misalignments. Non-correctable errors may result in downgrading chips (e.g., from 16 GB to 8 GB RAM), ensuring minimal waste.
He emphasized a pragmatic approach to tool selection, starting with REST endpoints and gradually adopting Kafka for streaming data as needs evolved. Johan also noted ASML’s collaboration with tool maintainers to enhance compatibility, such as improving Spark’s progress tracking for customer feedback.
Future of Chip Manufacturing
Looking ahead, Johan highlighted the industry’s push to diversify chip production beyond Taiwan, driven by geopolitical and economic factors. However, building new factories, or “fabs,” costing $10–20 billion, faces challenges like equipment backlogs and the need for highly skilled operators. ASML’s customer support teams, working alongside clients like Intel, underscore the specialized knowledge required.
Johan concluded by stressing the importance of a forward-looking mindset, with ASML’s roadmap prioritizing innovation over rigid methodologies. This approach, combined with Java’s robustness, ensures the platform’s scalability and adaptability in a rapidly evolving industry.
Links:
[PHPForumParis2023] Webperf: Boost Your PHP Apps with HTTP 103 Early Hints – Kévin Dunglas
Kévin Dunglas, co-founder of Les-Tilleuls.coop and creator of API Platform, delivered a dynamic session at Forum PHP 2023 on leveraging HTTP 103 Early Hints to enhance web performance in PHP applications. Drawing from his extensive experience in the PHP ecosystem and inspiration from technologies like Go and the Caddy web server, Kévin explored how this HTTP status code optimizes page load times. His talk provided actionable insights for developers seeking to improve user experiences through cutting-edge web protocols.
Understanding HTTP 103 Early Hints
Kévin introduced HTTP 103 Early Hints, a status code that allows servers to preemptively inform browsers about critical resources, such as CSS or JavaScript files, before the main response is fully processed. Unlike server push, which sends resources directly, Early Hints enables browsers to check their cache, reducing unnecessary data transfers. Kévin explained how this mechanism, supported by modern browsers, enhances performance by initiating resource fetching earlier, particularly for PHP applications built with frameworks like Symfony.
Practical Implementation in PHP
Delving into implementation, Kévin demonstrated how to integrate HTTP 103 Early Hints into PHP applications, using examples from API Platform. He highlighted the role of reverse proxies like Vulcain, developed in collaboration with Google, to enable Early Hints for web APIs. By showing how to configure servers to send these hints, Kévin illustrated their impact on reducing latency, especially for front-end and API-driven applications. His practical examples made the concept accessible, encouraging developers to adopt this technique.
Future Potential and Collaboration
Kévin concluded by discussing ongoing efforts to expand Early Hints’ applicability, particularly for APIs, through contributions from developers like Robin. He emphasized the collaborative nature of open-source projects, urging the PHP community to contribute to tools like Vulcain. By highlighting the performance benefits and ease of integration, Kévin inspired developers at Les-Tilleuls.coop and beyond to explore this emerging standard, enhancing the speed and efficiency of their applications.
Links:
[DevoxxBE2023] Moving Java Forward Together: Community Power
Sharat Chander, Oracle’s Senior Director of Java Developer Engagement, delivered a compelling session at DevoxxBE2023, emphasizing the Java community’s pivotal role in driving the language’s evolution. With over 25 years in the IT industry, Sharat’s passion for Java and community engagement shone through as he outlined how developers can contribute to Java’s future, ensuring its relevance for decades to come.
The Legacy and Longevity of Java
Sharat began by reflecting on Java’s 28-year journey, a testament to its enduring impact on software development. He engaged the audience with a poll, revealing the diverse experience levels among attendees, from those using Java for five years to veterans with over 25 years of expertise. This diversity underscores Java’s broad adoption across industries, from small startups to large enterprises.
Java’s success, Sharat argued, stems from its thoughtful innovation strategy. Unlike the “move fast and break things” mantra, the Java team prioritizes stability and backward compatibility, ensuring that applications built on older versions remain functional. Projects like Amber, Panama, and the recent introduction of virtual threads in Java 21 exemplify this incremental yet impactful approach to innovation.
Balancing Stability and Progress
Sharat addressed the tension between rapid innovation and maintaining stability, a challenge given Java’s extensive history. He highlighted the six-month release cadence introduced to reduce latency to innovation, allowing developers to adopt new features without waiting for major releases. This approach, likened to a train arriving every three minutes, minimizes disruption and enhances accessibility.
The Java team’s commitment to trust, innovation, and predictability guides its development process. Sharat emphasized that Java’s design principles—established 28 years ago—continue to shape its evolution, ensuring it meets the needs of diverse applications, from AI and big data to emerging fields like quantum computing.
Community as the Heart of Java
The core of Sharat’s message was the community’s role in Java’s vitality. He debunked the “build it and they will come” myth, stressing that Java’s success relies on active community participation. Programs like the OpenJDK project invite developers to engage with mailing lists, review code check-ins, and contribute to technical decisions, fostering transparency and collaboration.
Sharat also highlighted foundational programs like the Java Community Process (JCP) and Java Champions, who advocate for Java independently, providing critical feedback to the Java team. He encouraged attendees to join Java User Groups (JUGs), noting the nearly 400 groups worldwide as vital hubs for knowledge sharing and networking.
Digital Engagement and Future Initiatives
Recognizing the digital era’s impact, Sharat discussed Oracle’s efforts to reach Java’s 10 million developers through platforms like dev.java. This portal aggregates learning resources, community content, and programs like JEEP Cafe and Sip of Java, which offer digestible insights into Java’s features. The recently launched Java Playground provides a browser-based environment for experimenting with code snippets, accelerating feature adoption.
Sharat also announced the community contributions initiative on dev.java, featuring content from Java Champions like Venkat Subramaniam and Hannes Kutz. This platform aims to showcase community expertise, encouraging developers to submit their best practices via GitHub pull requests.
Nurturing Diversity and Inclusion
A poignant moment in Sharat’s talk was his call for greater gender diversity in the Java community. He acknowledged the industry’s shortcomings in achieving balanced representation and urged collective action to expand the community’s mindshare. Programs like JDuchess aim to create inclusive spaces, ensuring Java’s evolution benefits from diverse perspectives.
Links:
[NodeCongress2023] The Road to Async Context: Standardizing Contextual Data Tracking in Asynchronous JavaScript
Lecturer
James M Snell
James M Snell is a Systems Engineer on the Cloudflare Workers team. He is a highly influential figure in the JavaScript runtime space, serving as a core contributor to the Node.js project and a member of the Node.js Technical Steering Committee (TSC). His work focuses on driving the adoption of web-compatible standard APIs across diverse JavaScript runtime environments, including Node.js, Deno, and Cloudflare Workers. Before his current role, he spent 16 years working on open technologies and standards at IBM. He is actively involved in the Web-interoperable Runtimes Community Group (WinterCG).
- Institutional Profile/Professional Page: jasnell.me
- X (Twitter): @jasnell
- Organization: Cloudflare Workers
Abstract
This article examines the evolution and standardization efforts surrounding Async Context in JavaScript runtimes, transitioning from Node.js’s AsyncLocalStorage to the proposed AsyncContext API within the TC-39 standards body. The analysis defines the core problem of tracking contextual data across asynchronous boundaries and explains the mechanism by which AsyncContext provides a deterministic, reliable way to manage this state, which is vital for modern diagnostic, security, and feature management tools. The article highlights the methodology of the Web-interoperable Runtimes Community Group (WinterCG) in establishing a portable subset of this API for immediate cross-runtime compatibility.
Context: The Asynchronous State Problem
In a synchronous programming environment, state—such as user identity, transaction ID, or locale settings—is managed within a thread’s local memory (thread-local storage). However, modern JavaScript runtimes operate on a single thread with a shared event loop, where a single incoming request often forks into multiple asynchronous operations (I/O, network calls, timers) that execute non-sequentially. The fundamental challenge is maintaining this contextual information reliably across these asynchronous function boundaries. Traditional solutions, like passing context through function arguments, are impractical and violate encapsulation.
Methodology and Mechanisms
Async Context Tracking
The core concept of Async Context (first implemented as AsyncLocalStorage in Node.js) involves a model that links contextual information to the asynchronous flow of execution.
- Asynchronous Resource Stack: Context tracking is achieved by building a stack of “asynchronous resources”. When an asynchronous operation (e.g., a promise, a timer, or an HTTP request) begins, a new entry is added to this conceptual stack.
- The
runMethod: The primary public API for setting context is therunmethod, which executes a function within a new, dedicated context frame. Any asynchronous work initiated within this function will inherit that context.
The Move to AsyncContext
The standardization effort in TC-39 aims to introduce AsyncContext as a native language feature, replacing runtime-specific APIs like AsyncLocalStorage. The key difference in the future AsyncContext model is a move towards immutability within the context frame, specifically deprecating mutable methods like enter and exit that Node.js historically experimented with in AsyncResource. The consensus is to maintain the determinism and integrity of the context by requiring a new frame to be created for any changes, thus making the context “immutable across asynchronous boundaries”.
Consequences and Interoperability
The implications of standardized Async Context are significant, primarily for Observability and Cross-Runtime Compatibility:
- Observability (Diagnostics): The context mechanism is critical for application performance monitoring (APM) and diagnostics. It allows an instrument to reliably attach a request ID, correlation ID, or span data to every operation performed during the lifecycle of a single incoming request, which is essential for distributed tracing.
- Runtime Interoperability: The Web-interoperable Runtimes Community Group (WinterCG) is actively defining a “portable subset” of the
AsyncLocalStorageAPI. This subset is designed to be compatible with the forthcomingAsyncContextstandard and is being implemented across multiple runtimes (Node.js, Cloudflare Workers, Deno, Bun) in advance. This collective effort is paving the way for truly portable JavaScript code, where contextual state management is a reliable, universal primitive.
Conclusion
The standardization of Async Context represents a pivotal development in the maturity of server-side JavaScript. By integrating a reliable mechanism for tracking contextual state across asynchronous flows, the community is solving a long-standing architectural complexity. The collaboration within WinterCG ensures that this critical feature is implemented uniformly, fostering a more robust, standards-compliant, and portable ecosystem for all major JavaScript runtimes.
Relevant links and hashtags
- Lecture Video: The Road to Async Context – James M Snell, Node Congress 2023
- Lecturer Professional Links:
- Professional Page: jasnell.me
- X (Twitter): @jasnell
- Organization: Cloudflare Workers
Hashtags: #AsyncContext #AsyncLocalStorage #TC39 #WinterCG #NodeJS #CloudflareWorkers #JavaScriptStandards #Observability #NodeCongress
[PHPForumParis2022] Internet and Geopolitics – Stéphane Bortzmeyer
Stéphane Bortzmeyer, a seasoned expert in Internet infrastructure, delivered a thought-provoking presentation at PHP Forum Paris 2022, exploring the intricate relationship between the Internet and geopolitics. Dedicated to Mahsa Amini, whose tragic death sparked a revolt in Iran, Stéphane’s talk illuminated how global politics shape the Internet’s architecture and accessibility. With a focus on real-world examples, he challenged developers to consider the geopolitical implications of their work, particularly in the context of PHP-driven applications that rely on global connectivity.
The Myth of the Cloud
Stéphane began by debunking the term “cloud,” criticizing it as a marketing ploy that obscures the Internet’s physical and political realities. Far from being a borderless entity, the Internet is deeply tied to national jurisdictions, data centers, and political decisions. He highlighted how regimes, such as Iran’s, manipulate Internet access to suppress dissent, using censorship and throttling to control information flow. For PHP developers, this underscores the importance of designing applications that account for such restrictions, ensuring accessibility and resilience in diverse geopolitical contexts.
Global Connectivity Challenges
Delving into connectivity, Stéphane explained how historical and economic factors create disparities in Internet access. He cited Colombia, where local content is often hosted abroad due to limited domestic infrastructure, creating a self-reinforcing cycle of dependency on foreign connections. This phenomenon, driven by business interests rather than technical necessity, affects latency and accessibility for PHP applications. Stéphane urged developers to advocate for local interconnection and consider hosting strategies that prioritize user experience in underserved regions.
The Role of Regulation and Advocacy
Addressing regulatory responses, Stéphane contrasted Bolivia’s legal mandates for local interconnection with Europe’s reliance on user and government pressure. He emphasized that developers can influence these dynamics by supporting open Internet standards and advocating for equitable access. For PHP developers, this means building applications that are adaptable to varying network conditions and contributing to discussions on infrastructure policies. Stéphane’s insights highlighted the developer’s role in fostering a more inclusive and resilient Internet.
Empowering Developers to Act
Concluding, Stéphane called on developers to engage with the geopolitical aspects of their work, from choosing hosting providers to supporting open standards. By understanding the Internet’s physical and political constraints, PHP developers can create applications that better serve global audiences. His dedication to Mahsa Amini served as a poignant reminder of the stakes involved, inspiring attendees to approach their craft with a broader perspective on its societal impact.