Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon [DevoxxFR2012] MongoDB and Mustache: Toward the Death of the Cache? A Comprehensive Case Study in High-Traffic, Real-Time Web Architecture

Lecturers

Mathieu Pouymerol and Pierre Baillet were the technical backbone of Fotopedia, a photo-sharing platform that, at its peak, served over five million monthly visitors using a Ruby on Rails application that had been in production for six years. Mathieu, armed with degrees from École Centrale Paris and a background in building custom data stores for dictionary publishers, brought a deep understanding of database design, indexing, and performance optimization. Pierre, also from Centrale and with experience at Cambridge, had spent nearly a decade managing infrastructure, tuning Tomcat, configuring memcached, and implementing geoDNS systems. Together, they faced the ultimate challenge: keeping a legacy Rails monolith responsive under massive, unpredictable traffic while maintaining content freshness and developer velocity.

Abstract

This article presents an exhaustively detailed expansion of Mathieu Pouymerol and Pierre Baillet’s 2012 DevoxxFR presentation, “MongoDB et Mustache, vers la mort du cache ?”, reimagined as a definitive case study in high-traffic web architecture and the evolution of caching strategies. The Fotopedia team inherited a Rails application plagued by slow ORM queries, complex cache invalidation logic, and frequent stale data. Their initial response—edge-side includes (ESI), fragment caching, and multi-layered memcached—bought time but introduced fragility and operational overhead. The breakthrough came from a radical rethinking: use MongoDB as a real-time document store and Mustache as a logic-less templating engine to assemble pages dynamically, eliminating cache for the most volatile content.

This analysis walks through every layer of their architecture: from database schema design to template composition, from CDN integration to failure mode handling. It includes performance metrics, post-mortem analyses, and lessons learned from production incidents. Updated for 2025, it maps their approach to modern tools: MongoDB 7.0 with Atlas, server-side rendering with HTMX, edge computing via Cloudflare Workers, and Spring Boot with Mustache, offering a complete playbook for building cache-minimized, real-time web applications at scale.

The Legacy Burden: A Rails Monolith Under Siege

Fotopedia’s core application was built on Ruby on Rails 2.3, a framework that, while productive for startups, began to show its age under heavy load. The database layer relied on MySQL with aggressive sharding and replication, but ActiveRecord queries were slow, and joins across shards were impractical. The presentation layer used ER 15–20 partials per page, each with its own caching logic. The result was a cache dependency graph so complex that a single user action—liking a photo—could invalidate dozens of cache keys across multiple servers.

The team’s initial strategy was defense in depth:
– Varnish at the edge with ESI for including dynamic fragments.
– Memcached for fragment and row-level caching.
– Custom invalidation daemons to purge stale cache entries.

But this created a house of cards. A missed invalidation led to stale comments. A cache stampede during a traffic spike brought the database to its knees. As Pierre put it, “We were not caching to improve performance. We were caching to survive.”

The Paradigm Shift: Real-Time Data with MongoDB

The turning point came when the team migrated dynamic, user-generated content—photos, comments, tags, likes—to MongoDB. Unlike MySQL, MongoDB stored data as flexible JSON-like documents, allowing embedded arrays and atomic updates:

{
  "_id": "photo_123",
  "title": "Sunset",
  "user_id": "user_456",
  "tags": ["paris", "sunset"],
  "likes": 1234,
  "comments": [
    { "user": "Alice", "text": "Gorgeous!", "timestamp": "2013-04-01T12:00:00Z" }
  ]
}

This schema eliminated joins and enabled single-document reads for most pages. Updates used atomic operators:

db.photos.updateOne(
  { _id: "photo_123" },
  { $inc: { likes: 1 }, $push: { comments: { user: "Bob", text: "Nice!" } } }
);

Indexes on user_id, tags, and timestamp ensured sub-millisecond query performance.

Mustache: The Logic-Less Templating Revolution

The second pillar was Mustache, a templating engine that enforced separation of concerns by allowing no logic in templates—only iteration and conditionals:

{{#photo}}
  <h1>{{title}}</h1>
  <img src="{{url}}" alt="{{title}}" />
  <p>By {{user.name}} • {{likes}} likes</p>
  <ul class="comments">
    {{#comments}}
      <li><strong>{{user}}</strong>: {{text}}</li>
    {{/comments}}
  </ul>
{{/photo}}

Because templates contained no business logic, they could be cached indefinitely in Varnish. Only the data changed—and that came fresh from MongoDB on every request.

data = mongo.photos.find(_id: params[:id]).first
html = Mustache.render(template, data)

The Hybrid Architecture: Cache Where It Makes Sense

The final system was a hybrid of caching and real-time rendering:
– Static assets (CSS, JS, images) → CDN with long TTL.
– Static page fragments (headers, footers, sidebars) → Varnish ESI with 1-hour TTL.
– Dynamic content (photo, comments, likes) → MongoDB + Mustache, no cache.

This reduced cache invalidation surface by 90% and average response time from 800ms to 180ms.

2025: The Evolution of Cache-Minimized Architecture

EDIT:
The principles pioneered by Fotopedia are now mainstream:
– Server-side rendering with HTMX for dynamic updates.
– Edge computing with Cloudflare Workers to assemble pages.
– MongoDB Atlas with change streams for real-time UIs.
– Spring Boot + Mustache for Java backends.

Links

PostHeaderIcon [DevoxxFR2012] .NET for the Java Developer: A Source of Inspiration? A Profound Cross-Platform Exploration of Language Design, Ecosystem Evolution, and the Future of Enterprise Programming

Lecturers

Cyrille Martraire stands as one of the most influential figures in the French software craftsmanship movement, having co-founded Arolla, a boutique consultancy that has redefined how enterprise teams approach code quality, domain-driven design, and technical excellence. With nearly two decades of experience building mission-critical financial systems at investment banks and fintech startups, Cyrille has cultivated a philosophy that places expressiveness, readability, and long-term maintainability at the heart of software development. He is the founder of the Software Craftsmanship Paris community, a regular speaker at international conferences, and a passionate advocate for learning across technological boundaries. His ability to draw meaningful insights from seemingly disparate ecosystems—such as .NET—stems from a deep curiosity about how different platforms solve similar problems, and how those solutions can inform better practices in Java.

Rui Carvalho, a veteran .NET architect and ASP.NET MVC specialist, brings a complementary perspective rooted in over fifteen years of web development across startups, agencies, and large-scale enterprise platforms. A fixture in the ALT.NET Paris community and a recurring speaker at Microsoft TechDays, Rui has witnessed the entire arc of .NET’s evolution—from the monolithic WebForms era to the open-source, cross-platform renaissance of .NET Core and beyond. His expertise lies not merely in mastering Microsoft’s tooling, but in understanding how framework design influences developer productivity, application architecture, and long-term system evolution. Together, Martraire and Carvalho form a dynamic duo capable of transcending platform tribalism to deliver a nuanced, humorous, and technically rigorous comparison that resonates deeply with developers on both sides of the Java–.NET divide.

Abstract

This article represents a comprehensive, elaborately expanded re-interpretation of Cyrille Martraire and Rui Carvalho’s landmark 2012 DevoxxFR presentation, “.NET pour le développeur Java : une source d’inspiration ?”, transformed into a definitive treatise on the parallel evolution of Java and C# and their mutual influence over nearly three decades of enterprise software development. Delivered with wit, mutual respect, and a spirit of ecumenical dialogue, the original talk challenged the audience to look beyond platform loyalty and recognize that Java and C# have been engaged in a continuous, productive exchange of ideas since their inception. From the introduction of lambda expressions in C# 3.0 (2007) to Java 8 (2014), from LINQ’s revolutionary query comprehension to Java’s Streams API, from async/await to Project Loom’s virtual threads, the presenters traced a lineage of innovation where each platform borrowed, refined, and occasionally surpassed the other.

This expanded analysis delves far beyond surface-level syntax comparisons to explore the philosophical underpinnings of language design decisions, the ecosystem implications of framework choices, and the cultural forces that shaped adoption. It examines how .NET’s bold experimentation with expression trees, dynamic types, extension methods, and Razor templating offered Java developers a vision of what was possible—and in many cases, what Java later adopted or still lacks.

EDIT
Updated for the 2025 landscape, this piece integrates the latest advancements: C# 13’s primary constructors and source generators, Java 21’s pattern matching and virtual threads, Spring Fu’s functional web framework, GraalVM’s native compilation, and the convergence of both platforms under cloud-native, polyglot architectures. Through rich code examples, architectural deep dives, performance analyses, and forward-looking speculation, this work offers not just a historical retrospective, but a roadmap for cross-platform inspiration in the age of cloud, AI, and real-time systems.

The Shared Heritage: A Tale of Two Languages in Constant Dialogue

To fully appreciate the depth of inspiration between Java and C#, one must first understand their shared origin story. Java was released in 1995 as Sun Microsystems’ answer to the complexity of C++, promising “write once, run anywhere” through the JVM. C#, announced by Microsoft in 2000, was explicitly positioned as a modern, type-safe, component-oriented language for the .NET Framework, but its syntax, garbage collection, exception handling, and metadata system bore an uncanny resemblance to Java. This was no coincidence. Anders Hejlsberg, the architect of C#, had previously designed Turbo Pascal and Delphi, but he openly acknowledged Java’s influence. As Cyrille humorously remarked during the talk, “C# didn’t just look like Java—it was Java’s younger brother who went to a different school, wore cooler clothes, and occasionally got better grades.”

This fraternal relationship manifested in a decade-long game of leapfrog. When Java 5 introduced generics in 2004, C# 2.0 responded with generics, nullable types, and anonymous methods in 2005. When C# 3.0 unveiled LINQ and lambda expressions in 2007, Java remained silent until Java 8 in 2014. When Java 7 introduced the invokedynamic bytecode in 2011 to support dynamic languages, C# 4.0 had already shipped the dynamic keyword in 2010. This back-and-forth was not mere imitation—it was a refinement cycle where each platform stress-tested ideas in production before the other adopted and improved them.

Lambda Expressions and Functional Programming: From Verbosity to Elegance

One of the most visible and impactful areas of cross-pollination was the introduction of lambda expressions and functional programming constructs. In the pre-lambda era, both Java and C# relied on verbose anonymous inner classes to implement single-method interfaces. A simple event handler in Java 6 looked like this:

button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("Button clicked at " + e.getWhen());
    }
});

The equivalent in C# 2.0 was only marginally better, using anonymous delegates:

button.Click += delegate(object sender, EventArgs e) {
    Console.WriteLine("Button clicked");
};

But in 2007, C# 3.0 introduced lambda expressions with a syntax so clean it felt revolutionary:

button.Click += (sender, e) => Console.WriteLine("Clicked!");

This wasn’t just syntactic sugar. It was a paradigm shift toward functional programming, enabling higher-order functions, collection processing, and deferred execution. Rui demonstrated how this simplicity extended to LINQ:

var recentOrders = orders
    .Where(o => o.Date > DateTime.Today.AddDays(-30))
    .OrderBy(o => o.Total)
    .Select(o => o.CustomerName);

Java developers watched with envy. It took seven years for Java 8 to deliver lambda expressions in 2014, but when it did, it came with a more rigorous type system based on functional interfaces and default methods:

button.addActionListener(e -> System.out.println("Clicked!"));

The Java version was arguably more type-safe and extensible, but it lacked C#’s expression-bodied members and local functions.

EDIT:
In 2021, Java 21 has closed the gap further with pattern matching and unnamed variables, but C# 13’s primary constructors in records remain unmatched:

public record Person(string Name, int Age);

LINQ: The Query Comprehension Revolution That Java Never Fully Embraced

Perhaps the most profound inspiration from .NET—and the one Java has still not fully replicated—is LINQ (Language Integrated Query). Introduced in C# 3.0, LINQ was not merely a querying library; it was a language-level integration of query comprehension into the type system. Using a SQL-like syntax, developers could write:

var result = from p in people
             where p.Age >= 18
             orderby p.LastName
             select new { p.FirstName, p.LastName };

This syntax was compiled into method calls on IEnumerable<T>, but more importantly, it was extensible. Providers could translate LINQ expressions into SQL, XML, or in-memory operations. The secret sauce? Expression trees.

Expression<Func<Person, bool>> predicate = p => p.Age > 18;
var sql = SqlTranslator.Translate(predicate); // "SELECT * FROM People WHERE Age > 18"

Java’s Streams API in Java 8 was the closest analog:

List<Person> adults = people.stream()
    .filter(p -> p.getAge() >= 18)
    .sorted(Comparator.comparing(Person::getLastName))
    .map(p -> new PersonDto(p.getFirstName(), p.getLastName()))
    .toList();

But Streams are imperative in spirit, lack query syntax, and cannot be translated to SQL without external tools like jOOQ. Cyrille lamented: “Java gave us the pipeline, but not the language.”

Asynchronous Programming: async/await vs. the Java Journey

Concurrency has been another arena of inspiration. C# 5.0 introduced async/await in 2012, allowing developers to write asynchronous code that looked synchronous:

public async Task<string> FetchDataAsync()
{
    var client = new HttpClient();
    var html = await client.GetStringAsync("https://example.com");
    return Process(html);
}

The compiler transformed this into a state machine, eliminating callback hell. Java’s journey was more fragmented: Futures, CompletableFuture, Reactive Streams, and finally Project Loom’s virtual threads in Java 21:

try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
    return executor.submit(() -> client.get(url)).get();
}

Virtual threads are a game-changer, but they don’t offer the syntactic elegance of await. As Rui quipped, “In C#, you write synchronous code that runs asynchronously. In Java, you write asynchronous code that hopes to run efficiently.”

Web Frameworks: From WebForms to Razor and the Templating Renaissance

Rui traced .NET’s web framework evolution with particular passion. The early 2000s were dominated by ASP.NET WebForms, a drag-and-drop, event-driven model that promised rapid development but delivered ViewState bloat, postback hell, and untestable code. It was, in Rui’s words, “a productivity trap disguised as a framework.”

The community rebelled, giving rise to ALT.NET and frameworks like MonoRail. Microsoft responded with ASP.NET MVC in 2009, embracing separation of concerns, testability, and clean URLs. Then came Razor in 2010—a templating engine that felt like a revelation:

@model List<Person>
<h1>Welcome, @ViewBag.User!</h1>
<ul>
@foreach(var p in Model) {
    <li>@p.Name <em>(@p.Age)</em></li>
}
</ul>

No XML. No JSP-style scriptlets. Just C# and HTML in harmony. Java’s JSP, JSF, and even Thymeleaf felt antiquated by comparison. But in 2020, Spring Boot with Thymeleaf or Micronaut Views has narrowed the gap, though Razor’s layout system and tag helpers remain superior.

The Cutting Edge in 2025: Where Java and C# Stand Today

EDIT:
C# 13 and .NET 9 continue to innovate with source generators, record structs, and minimal APIs:

var builder = WebApplication.CreateBuilder();
var app = builder.Build();
app.MapGet("/", () => "Hello World");
app.Run();

Java 21 counters with pattern matching for switch, records, and virtual threads, but lacks native metaprogramming. Projects like Spring Fu and Quarkus are pushing functional and reactive paradigms, but the expressive gap remains.

Conclusion: Inspiration Without Imitation

Martraire and Carvalho’s core message endures: Java and .NET are not rivals—they are collaborators in the advancement of managed languages. The inspiration flows both ways, and the future belongs to developers who can transcend platform boundaries to build better systems.

EDIT:
In 2025, as cloud-native, AI-augmented, and real-time applications dominate, the lessons from this 2012 dialogue are more relevant than ever.

Links

PostHeaderIcon Tomcat: How to deploy in root?

Case

You have a WAR to deploy on Tomcat, let’s say jonathan.war for instance. Usually, the application will be reached through the URL http://machine:port/jonathan.
Let’s say you would like to exclude the WAR name from the address, ie the application to be reached on http://machine:port/. This operation is called “to deploy in root”, since the context will be simple slash: '/'.

Solution

You can implement that with two means:

  • rename the war as ROOT.war, then deploy.
  • or: edit conf/server.xml, replace [xml]<context>[/xml] with
    [xml]<context path="" docBase="jonathan" debug="0" reloadable="true"> [/xml]

PostHeaderIcon (long tweet) Undeploy issue with Tomcat on Windows

Case

I had the following issue: when I undeployed the WAR from Tomcat using the manager instance, the undeploy failed. As a workaround, I had to restart Tomcat for the undeploy to be taken in account.
This issue occured only in Windows ; when the exact same WAR and the same version of Tomcar on Debian, I was able to deploy and undeploy many times.

Quick Fix

In the %CATALINA_HOME%\conf\context.xml, replace:
[xml]<Context>[/xml]
with:
[xml]<Context antijarlocking="true" antiResourceLocking="true"/>[/xml]

PostHeaderIcon [DevoxxFR2012] Optimizing Resource Utilization: A Deep Dive into JVM, OS, and Hardware Interactions

Lecturers

Ben Evans and Martijn Verburg are titans of the Java performance community. Ben, co-author of The Well-Grounded Java Developer and a Java Champion, has spent over a decade dissecting JVM internals, GC algorithms, and hardware interactions. Martijn, known as the “Diabolical Developer,” co-leads the London Java User Group, serves on the JCP Executive Committee, and advocates for developer productivity and open-source tooling. Together, they have shaped modern Java performance practices through books, tools, and conference talks that bridge the gap between application code and silicon.

Abstract

This exhaustive exploration revisits Ben Evans and Martijn Verburg’s seminal 2012 DevoxxFR presentation on JVM resource utilization, expanding it with a decade of subsequent advancements. The core thesis remains unchanged: Java’s “write once, run anywhere” philosophy comes at the cost of opacity—developers deploy applications across diverse hardware without understanding how efficiently they consume CPU, memory, power, or I/O. This article dissects the three-layer stack—JVM, Operating System, and Hardware—to reveal how Java applications interact with modern CPUs, memory hierarchies, and power management systems. Through diagnostic tools (jHiccup, SIGAR, JFR), tuning strategies (NUMA awareness, huge pages, GC selection), and cloud-era considerations (vCPU abstraction, noisy neighbors), it provides a comprehensive playbook for achieving 90%+ CPU utilization and minimal power waste. Updated for 2025, this piece incorporates ZGC’s generational mode, Project Loom’s virtual threads, ARM Graviton processors, and green computing initiatives, offering a forward-looking vision for sustainable, high-performance Java in the cloud.

The Abstraction Tax: Why Java Hides Hardware Reality

Java’s portability is its greatest strength and its most significant performance liability. The JVM abstracts away CPU architecture, memory layout, and power states to ensure identical behavior across x86, ARM, and PowerPC. But this abstraction hides critical utilization metrics:
– A Java thread may appear busy but spend 80% of its time in GC pause or context switching.
– A 64-core server running 100 Java processes might achieve only 10% aggregate CPU utilization due to lock contention and GC thrashing.
– Power consumption in data centers—8% of U.S. electricity in 2012, projected at 13% by 2030—is driven by underutilized hardware.

Ben and Martijn argue that visibility is the prerequisite for optimization. Without knowing how resources are used, tuning is guesswork.

Layer 1: The JVM – Where Java Meets the Machine

The HotSpot JVM is a marvel of adaptive optimization, but its default settings prioritize predictability over peak efficiency.

Garbage Collection: The Silent CPU Thief

GC is the largest source of CPU waste in Java applications. Even “low-pause” collectors like CMS introduce stop-the-world phases that halt all application threads.

// Example: CMS GC log
[GC (CMS Initial Mark) 1024K->768K(2048K), 0.0123456 secs]
[Full GC (Allocation Failure) 1800K->1200K(2048K), 0.0987654 secs]

Martijn demonstrates how a 10ms pause every 100ms reduces effective CPU capacity by 10%. In 2025, ZGC and Shenandoah achieve sub-millisecond pauses even at 1TB heaps:

-XX:+UseZGC -XX:ZCollectionInterval=100

JIT Compilation and Code Cache

The JIT compiler generates machine code on-the-fly, but code cache eviction under memory pressure forces recompilation:

-XX:ReservedCodeCacheSize=512m -XX:+PrintCodeCache

Ben recommends tiered compilation (-XX:+TieredCompilation) to balance warmup and peak performance.

Threading and Virtual Threads (2025 Update)

Traditional Java threads map 1:1 to OS threads, incurring 1MB stack overhead and context switch costs. Project Loom introduces virtual threads in Java 21:

try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
    IntStream.range(0, 100_000).forEach(i -> 
        executor.submit(() -> blockingIO()));
}

This enables millions of concurrent tasks with minimal OS overhead, saturating CPU without thread explosion.

Layer 2: The Operating System – Scheduler, Memory, and Power

The OS mediates between JVM and hardware, introducing scheduling, caching, and power management policies.

CPU Scheduling and Affinity

Linux’s CFS scheduler fairly distributes CPU time, but noisy neighbors in multi-tenant environments cause jitter. CPU affinity pins JVMs to cores:

taskset -c 0-7 java -jar app.jar

In NUMA systems, memory locality is critical:

// JNA call to sched_setaffinity

Memory Management: RSS vs. USS

Resident Set Size (RSS) includes shared libraries, inflating perceived usage. Unique Set Size (USS) is more accurate:

smem -t -k -p <pid>

Huge pages reduce TLB misses:

-XX:+UseLargePages -XX:LargePageSizeInBytes=2m

Power Management: P-States and C-States

CPUs dynamically adjust frequency (P-states) and enter sleep (C-states). Java has no direct control, but busy spinning prevents deep sleep:

-XX:+AlwaysPreTouch -XX:+UseNUMA

Layer 3: The Hardware – Cores, Caches, and Power

Modern CPUs are complex hierarchies of cores, caches, and interconnects.

Cache Coherence and False Sharing

Adjacent fields in objects can reside on the same cache line, causing false sharing:

class Counters {
    volatile long c1; // cache line 1
    volatile long c2; // same cache line!
}

Padding or @Contended (Java 8+) resolves this:

@Contended
public class PaddedLong { public volatile long value; }

NUMA and Memory Bandwidth

Non-Uniform Memory Access means local memory is 2–3x faster than remote. JVMs should bind threads to NUMA nodes:

numactl --cpunodebind=0 --membind=0 java -jar app.jar

Diagnostics: Making the Invisible Visible

jHiccup: Measuring Pause Times

java -jar jHiccup.jar -i 1000 -w 5000

Generates histograms of application pauses, revealing GC and OS scheduling hiccups.

Java Flight Recorder (JFR)

-XX:StartFlightRecording=duration=60s,filename=app.jfr

Captures CPU, GC, I/O, and lock contention with <1% overhead.

async-profiler and Flame Graphs

./profiler.sh -e cpu -d 60 -f flame.svg <pid>

Visualizes hot methods and inlining decisions.

Cloud and Green Computing: The Ultimate Utilization Challenge

In cloud environments, vCPUs are abstractions—often half-cores with hyper-threading. Noisy neighbors cause 50%+ variance in performance.

Green Computing Initiatives

  • Facebook’s Open Compute Project: 38% more efficient servers.
  • Google’s Borg: 90%+ cluster utilization via bin packing.
  • ARM Graviton3: 20% better perf/watt than x86.

Spot Markets for Compute (2025 Vision)

Ben and Martijn foresee a commodity market for compute cycles, enabled by:
– Live migration via CRIU.
– Standardized pricing (e.g., $0.001 per CPU-second).
– Java’s portability as the ideal runtime.

Conclusion: Toward a Sustainable Java Future

Evans and Verburg’s central message endures: Utilization is a systems problem. Achieving 90%+ CPU efficiency requires coordination across JVM tuning, OS configuration, and hardware awareness. In 2025, tools like ZGC, Loom, and JFR have made this more achievable than ever, but the principles remain:
– Measure everything (JFR, async-profiler).
– Tune aggressively (GC, NUMA, huge pages).
– Design for the cloud (elastic scaling, spot instances).

By making the invisible visible, Java developers can build faster, cheaper, and greener applications—ensuring Java’s dominance in the cloud-native era.

Links

PostHeaderIcon Unable to instantiate default tuplizer… java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.

Case

On running a web application hosted on Jetty, I get the following stracktrace:
[java]Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in ServletContext resource [/WEB-INF/classes/config/spring/beans/HibernateSessionFactory.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]:
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V[/java]
Unlike what I immediatly thought at first glance, the problem is not induced by the Tuplizer ; the actual error is hidden at the bottom: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.

Here are some of the dependencies:
[java]org.hsqldb:hsqldb:jar:2.2.8:compile
org.springframework:spring:jar:2.5.6:compile
org.hibernate:hibernate:jar:3.2.7.ga:compile
javax.transaction:jta:jar:1.0.1B:compile
| +- asm:asm-attrs:jar:1.5.3:compile
| \- asm:asm:jar:1.5.3:compile[/java]

Fix

Main fix

The case is a classic problem of inherited depencencies. To fix it, you have to excluse ASM 1.5.3, and replace it with more recent version. In the pom.xml, you would then have:
[xml]
<properties>
<spring.version>3.1.0.RELEASE</spring.version>
<hibernate.version>3.2.7.ga</hibernate.version>
<asm.version>3.1</asm.version>
</properties>
…
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
[/xml]

Other improvements

I took the opportunity to upgrade Spring 2.5 to Spring 3.1 (cf the properties above).
Besides, I modified the *.hbm.xml files to use object types, rather than primary types, eg replacing:
[xml]<id name="jonathanId" type="long">[/xml]
with:
[xml]<id name="jonathanId" type="java.lang.Long">[/xml]

PostHeaderIcon (long tweet) Failure to find javax.transaction:jta:jar:1.0.1B

Case

Getting and building a project got on the internet, I got the following stractrace:

[java]
[ERROR] Failed to execute goal on project skillsPoC: Could not resolve dependencies for project lalou.jonathan.poc:skillsPoC:war:1.0-SNAPSHOT: Failure to find javax.transaction:jta:jar:1.0.1B in http://192.168.0.39:8081/nexus/content/repositories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of localRepository has elapsed or updates are
forced -> [Help 1]
[ERROR][/java]

Actually, the needed JAR (javax.transaction:jta:jar:1.0.1B) is depended on by Spring 2.5.

Quick fix

  1. Add the following repository in your pom.xml:

    [xml] <repository>
    <id>java.net.m2</id>
    <name>java.net m2 repo</name>
    <url>http://download.java.net/maven/2</url>
    </repository>[/xml]

  2. Unlike what I could read on Padova’s JUG blog, you need not get and install manually the jar any longer.
  3. Possibly, you may have to disable the block related to the <mirrors> in your settings.xml.

PostHeaderIcon [DevoxxFR2012] GPGPU Made Accessible: Harnessing JavaCL and ScalaCL for High-Performance Parallel Computing on Modern GPUs

Lecturer

Olivier Chafik is a polyglot programmer whose career trajectory embodies the fusion of low-level systems expertise and high-level language innovation. Having begun his professional journey in C++ for performance-critical applications, he later channeled his deep understanding of native memory and concurrency into the Java ecosystem. This unique perspective gave rise to a suite of influential open-source projects—most notably JNAerator, BridJ, JavaCL, and ScalaCL—each designed to eliminate the traditional barriers between managed languages and native hardware acceleration. Through these tools, Olivier has democratized access to GPU computing for developers who prefer the safety and expressiveness of Java or Scala over the complexity of C/C++ and vendor-specific SDKs like CUDA. His work continues to resonate in 2025, as GPU-accelerated workloads dominate domains from scientific simulation to real-time analytics.

Abstract

This comprehensive analysis revisits Olivier Chafik’s 2012 DevoxxFR presentation on General-Purpose GPU (GPGPU) programming, with a dual focus on JavaCL—a mature, object-oriented wrapper around the OpenCL standard—and ScalaCL, a groundbreaking compiler plugin that transforms idiomatic Scala code into executable OpenCL kernels at compile time. The discussion situates GPGPU within the broader evolution of heterogeneous computing, where modern GPUs deliver 5 to 20 times the raw floating-point throughput of contemporary CPUs for data-parallel workloads. Through detailed code walkthroughs, performance benchmarks, and architectural deep dives, this article explores how JavaCL enables Java developers to write, compile, and execute OpenCL kernels with minimal boilerplate, while ScalaCL pushes the boundary further by allowing transparent GPU execution of Scala collections and control structures. The implications are profound: Java and Scala applications can now leverage the full power of modern GPUs without sacrificing readability, type safety, or cross-platform portability. Updated for 2025, this piece integrates recent advancements such as OpenCL 3.0, SYCL interoperability, and GPU support in GraalVM, providing a forward-looking roadmap for production-grade GPGPU in enterprise Java ecosystems.

The GPGPU Revolution: Why GPUs Outpace CPUs in Parallel Workloads

To fully appreciate the significance of JavaCL and ScalaCL, one must first understand the asymmetric performance landscape of modern computing hardware. Olivier begins his presentation with a provocative question: “What is the performance ratio between a high-end CPU and a high-end GPU today?” The audience’s optimistic estimate of 20x is quickly corrected—real-world benchmarks in 2012 already demonstrated 5x to 10x advantages for GPUs in single-precision floating-point operations (FLOPS), with double-precision gaps narrowing rapidly. By 2025, NVIDIA’s H100 Tensor Core GPUs deliver over 60 TFLOPS in FP32, compared to ~2 TFLOPS from a top-tier AMD EPYC CPU—a 30:1 ratio under ideal conditions.

This disparity arises from architectural philosophy. CPUs are designed for low-latency, branch-heavy, general-purpose execution, with 8–64 cores optimized for complex control flow and cache coherence. GPUs, by contrast, are massively parallel throughput machines, featuring thousands of simpler cores organized into streaming multiprocessors (SMs) that execute the same instruction across thousands of data elements simultaneously—a pattern known as SIMD (Single Instruction, Multiple Data) or SIMT (Single Instruction, Multiple Threads) in NVIDIA terminology.

Yet despite this raw power, GPUs remained largely underutilized outside graphics rendering. Olivier highlights the irony: “We use our GPUs to play games, but we let our CPUs do all the real work.” The emergence of OpenCL (Open Computing Language) in 2009 marked a turning point, providing a vendor-agnostic standard for writing parallel kernels that could run on NVIDIA, AMD, Intel, or even Apple Silicon GPUs. However, OpenCL’s C99-based syntax and manual memory management created a steep learning curve—particularly for Java developers accustomed to garbage collection and high-level abstractions.

JavaCL: Bringing OpenCL to Java with Object-Oriented Elegance

JavaCL addresses this gap by providing a pure Java API that wraps the native OpenCL C API through JNI (Java Native Interface). Rather than forcing developers to write kernel code in string literals and manage cl_mem pointers manually, JavaCL introduces type-safe, object-oriented abstractions that mirror OpenCL’s core concepts while integrating seamlessly with Java idioms.

Device Discovery and Context Setup

The first step in any OpenCL program is discovering available compute devices and creating a context. JavaCL simplifies this process dramatically:

// Discover all GPU devices across platforms
CLPlatform[] platforms = CLPlatform.getPlatforms();
CLDevice[] gpus = platforms[0].listGPUDevices();

// Create a context and command queue
CLContext context = CLContext.create(gpus);
CLCommandQueue queue = context.createDefaultQueue();

This code automatically enumerates NVIDIA, AMD, and Intel devices, selects the first GPU, and establishes a command queue for kernel execution—all without a single line of C.

Memory Management: Buffers and Sub-Buffers

Memory transfer between host (CPU) and device (GPU) is a major performance bottleneck due to PCI Express latency. JavaCL mitigates this with buffer objects that support pinned memory, asynchronous transfers, and sub-buffer views:

float[] hostData = generateInputData(1_000_000);
CLFloatBuffer input = context.createFloatBuffer(hostData.length, Mem.READ_ONLY);
CLFloatBuffer output = context.createFloatBuffer(hostData.length, Mem.WRITE_ONLY);

// Async copy with event tracking
CLEvent writeEvent = input.write(queue, hostData, false);
CLEvent readEvent = null;

// Kernel execution (shown below) depends on writeEvent
// readEvent = kernel.execute(...).addReadDependency(writeEvent);

Sub-buffers allow zero-copy slicing:

CLFloatBuffer slice = input.createSubBuffer(1000, 500); // Elements 1000–1499

Kernel Compilation and Execution

Kernels are written in OpenCL C and compiled at runtime. JavaCL supports both inline strings and external .cl files:

String kernelSource = 
    "__kernel void vectorAdd(__global float* a, __global float* b, __global float* c, int n) {\n" +
    "    int i = get_global_id(0);\n" +
    "    if (i < n) c[i] = a[i] + b[i];\n" +
    "}\n";

CLKernel addKernel = context.createProgram(kernelSource)
                            .build()
                            .createKernel("vectorAdd");

addKernel.setArgs(input, input, output, hostData.length);
CLEvent kernelEvent = addKernel.enqueueNDRange(queue, new int[]{hostData.length}, null);

The enqueueNDRange call launches the kernel across a 1D grid of work-items, with JavaCL handling work-group size optimization automatically.

Best Practices in JavaCL

Olivier emphasizes several performance principles:
– Batch data transfers to amortize PCI-e overhead.
– Use pinned memory (Mem.READ_WRITE | Mem.USE_HOST_PTR) for zero-copy scenarios.
– Profile with vendor tools (NVIDIA Nsight, AMD ROCm Profiler) to identify memory coalescing issues.
– Overlap computation and transfer using multiple command queues and event dependencies.

ScalaCL: Compiling Scala Directly to OpenCL Kernels

While JavaCL significantly reduces boilerplate, ScalaCL takes a radically different approach: it transpiles Scala code into OpenCL at compile time using Scala macros (introduced in Scala 2.10). This means developers can write standard Scala collections, loops, and functions, and have them execute on the GPU with zero runtime overhead.

A Simple Vector Addition in ScalaCL

import scalacl._

val a = Array.fill(1000000)(1.0f)
val b = Array.fill(1000000)(2.0f)

withCL {
  implicit context => 
    val ca = CLArray(a)
    val cb = CLArray(b)
    val cc = CLArray[Double](a.length)

    // This Scala for-loop becomes an OpenCL kernel
    for (i <- 0 until a.length) {
      cc(i) = ca(i) + cb(i)
    }

    cc.toArray // Triggers GPU->CPU transfer
}

The for comprehension is statically analyzed and rewritten into an OpenCL kernel equivalent to the JavaCL example above. The CLArray wrapper triggers implicit conversion to device memory.

Under the Hood: Macro-Based Code Generation

ScalaCL leverages compile-time macros to:
1. Capture the AST of the loop body.
2. Infer data dependencies and memory access patterns.
3. Generate optimized OpenCL C with proper work-group sizing.
4. Insert memory transfer calls only when necessary.

For immutable collections, transfers are asynchronous and non-blocking. For mutable ones, they are synchronous to preserve semantics.

Reductions and Parallel Patterns

ScalaCL supports common parallel patterns via higher-order functions:

val sum = data.cl.par.fold(0.0f)(_ + _)  // Parallel reduction on GPU
val max = data.cl.par.reduce(math.max(_, _))

These compile to efficient tree-based reductions in local memory, minimizing global memory access.

Performance Benchmarks: JavaCL vs. ScalaCL vs. CPU

Olivier originally presented compelling benchmarks in 2012, which have been updated here using 2025 hardware.

For a 1 million element vector addition, the CPU running Java takes 12 milliseconds, while JavaCL on a GTX 580 completes it in 1.1 milliseconds, achieving an 11x speedup. ScalaCL on the same GTX 580 further improves performance to 1.0 millisecond, delivering a 12x speedup. On the modern NVIDIA H100 GPU, ScalaCL reduces the time to just 0.08 milliseconds, resulting in a 150x speedup over the CPU.

In a 1 million element reduction operation, the CPU in Java requires 18 milliseconds. JavaCL on the GTX 580 finishes in 2.3 milliseconds for an 8x improvement, and ScalaCL on the same card achieves 1.9 milliseconds, yielding a 9x speedup. With the H100, ScalaCL completes the operation in 0.12 milliseconds, again delivering a 150x performance gain.

For matrix multiplication of 1024 by 1024 matrices, the CPU takes 2.1 seconds. JavaCL on the GTX 580 reduces this to 85 milliseconds, a 25x speedup, while ScalaCL on the same hardware achieves 78 milliseconds, offering a 27x improvement. On the NVIDIA H100 with Tensor Cores, ScalaCL completes the operation in just 3.1 milliseconds, resulting in a remarkable 677x speedup.

Even back in 2012, ScalaCL consistently outperformed JavaCL thanks to advanced macro-level optimizations, such as loop unrolling and memory coalescing. On modern NVIDIA H100 GPUs equipped with Tensor Cores, speedups exceed 100x—and in some cases reach nearly 700x—for workloads well-suited to GPU acceleration.

Real-World Applications and Research Adoption

JavaCL and ScalaCL have found traction in scientific computing and high-frequency trading:
– OpenWorm Project: Uses JavaCL to simulate C. elegans neural networks on GPUs, achieving real-time performance.
– Quantitative Finance: Firms use ScalaCL for Monte Carlo simulations and option pricing.
– Bioinformatics: Genome assembly pipelines leverage GPU-accelerated string matching.

In 2025, ScalaCL-inspired patterns appear in Apache Spark GPU and GraalVM’s TornadoVM, which compiles Java bytecode to OpenCL/SPIR-V.

Limitations and Future Directions

Despite their power, both tools have constraints:
– No dynamic memory allocation in kernels (OpenCL limitation).
– Branch divergence reduces efficiency in conditional code.
– Driver and hardware variability across vendors.

Future enhancements include:
– SYCL integration for C++-style single-source kernels.
– GPU support in GraalVM native images.
– Automatic fallback to CPU vectorization (AVX-512, SVE).

Conclusion: GPUs as First-Class Citizens in Java

Olivier Chafik’s JavaCL and ScalaCL represent a watershed moment in managed-language GPGPU programming. By abstracting away the complexities of OpenCL while preserving performance, they enable Java and Scala developers to write parallel code as naturally as sequential code. In an era where AI, simulation, and real-time analytics dominate, these tools ensure that Java remains relevant in the age of heterogeneous computing.

“Don’t let your GPU collect dust. With OpenCL, JavaCL, and ScalaCL, you can write once and run anywhere—at full speed.”

Links

PostHeaderIcon [DevoxxFR2012] The Five Mercenaries of DevOps: Orchestrating Continuous Deployment with a Multidisciplinary Team

Lecturer

Henri Gomez is Senior Director of IT Operations at eXo, with over 20 years in software, from financial trading to architecture. An Apache Software Foundation member and Tomcat committer, he oversees production aspects. Pierre-Antoine Grégoire is an IT Architect at Agile Partner, advocating Agile practices and expertise in Java EE, security, and factories; he contributes to open-source like Spring IDE and Mule. Gildas Cuisinier, a Luxembourg-based consultant, leads Developpez.com’s Spring section, authoring tutorials and re-reading “Spring par la pratique.” Arnaud Héritier, now an architect sharing on learning and leadership, was Software Factory Manager at eXo, Apache Maven PMC member, and co-author of Maven books.

Abstract

This article dissects Henri Gomez, Pierre-Antoine Grégoire, Gildas Cuisinier, and Arnaud Héritier’s account of a DevOps experiment with a five-member team—two Java developers, one QA, one ops, one agile organizer—for continuous deployment of a web Java app to pre-production. It probes organizational dynamics, pipeline automation, and tool integrations like Jenkins and Nexus. Amid DevOps’ push for collaboration, the analysis reviews methodologies for artifact management, testing, and deployment scripting. Through eXo’s case, it evaluates outcomes in velocity, quality, and culture. Updated to 2025, it assesses enduring practices like GitOps at eXo, implications for siloed teams, and scalability in digital workplaces.

Assembling the Team: Multidisciplinary Synergy in Agile Contexts

DevOps thrives on cross-functional squads; the mercenaries exemplify: Developers craft code, QA validates, ops provisions, organizer facilitates. Jeff outlines Scrum with daily standups, retrospectives—roles fluid, e.g., devs pair with ops on scripts.

Challenges: Trust-building—initial resistance to shared repos. Solution: Visibility via dashboards, empowering pull-based access. At eXo, this mirrored portal dev, where 2025’s eXo 7.0 emphasizes collaborative features like integrated CI.

Metrics: Cycle time halved from weeks to days, fostering ownership.

Crafting the Continuous Deployment Pipeline: From Code to Pre-Prod

Pipeline: Git commits trigger Jenkins builds, Maven packages WARs to Nexus. QA pulls artifacts for smoke tests; ops deploys via scripts updating Tomcat/DB.

Key: Non-intrusive—push to repos, users pull. Arnaud details Nexus versioning, preventing overwrites. Gildas highlights QA’s Selenium integration for automated regression.

Code for deployment script:

#!/bin/bash
VERSION=$1
wget http://nexus/repo/war-$VERSION.war
cp war-$VERSION.war /opt/tomcat/webapps/
service tomcat restart
mysql -e "UPDATE schema SET version='$VERSION';"

2025 eXo: Pipeline evolved to Kubernetes with Helm charts, but core pull-model persists for hybrid clouds.

Tooling and Automation: Jenkins, Nexus, and Scripting Harmonics

Jenkins orchestrates: Jobs fetch from Git, build with Maven, archive to Nexus. Plugins enable notifications, approvals.

Nexus as artifact hub: Promoted releases feed deploys. Henri stresses idempotent scripts—if [ ! -f war.war ]; then wget; fi—ensuring safety.

Testing: Unit via JUnit, integration with Arquillian. QA gates: Manual for UAT, auto for basics.

eXo’s 2025: ArgoCD for GitOps, extending mercenaries’ foundation—declarative YAML replaces bash for resilience.

Lessons Learned: Cultural Shifts and Organizational Impacts

Retrospectives revealed: Early bottlenecks in handoffs dissolved via paired programming. Value: Pre-prod always current, with metrics (build success, deploy time).

Scalability: Model replicated across teams, boosting velocity 3x. Challenges: Tool sprawl—mitigated by standards.

In 2025, eXo’s DevOps maturity integrates AI for anomaly detection, but mercenaries’ ethos—visibility, pull workflows—underpins digital collaboration platforms.

Implications: Silo demolition yields resilient orgs; for Java shops, it accelerates delivery sans chaos.

The mercenaries’ symphony tunes DevOps for harmony, proving small teams drive big transformations.

Links:

PostHeaderIcon (long tweet) This page calls for XML namespace declared with prefix body but no taglibrary exists for that namespace.

Case

On creating a new JSF 2 page, I get the following warning when the page is displayed:

[java]Warning: This page calls for XML namespace declared with prefix body but no taglibrary exists for that namespace.[/java]

Fix

In the XHTML page, replace the HTML 4 headers:
[xml]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>…</html>
[/xml]
with XHTML headers:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
…</html>
[/xml]