Tuesday, March 5, 2019

Way to MyFaces 2.3-next

I (and other commiters) spend many hours to prepare the MyFaces codebase for the upcoming version 2.3-next during the last months, which will be MyFaces 4.0 in the future.
JSF (or Jakarta Faces) 3.0 will be 1:1 the same as JSF 2.3, just with the jakarta.* package names.

In 2.3-next, we did BIG BIG cleanup of our codebase and build.
Wee also removed the old JSF EL (javax.faces.el.*) and @ManagedBean (javax.faces.bean.*) implementations.
What does this mean? The API (javax.faces.el.*) and (javax.faces.bean.*) is still there but the implementation of it has been removed partially. @ManagedBean's are now registered as CDI beans, which means that a CDI runtime is a required dependency now.

The biggest clenaup was that we merged back the "shared" and "shared-public" modules to myfaces-impl, as the shared modules are no longer used by other active projects under the MyFaces umbrella.
We also introduced some real integration tests with Arquillian, to test parts of the container integration and AJAX client side. This makes around 1600 unittests!

OK.... Lets compare some numbers!

JAR size:


Mojarra 2.3 MyFaces 2.3 MyFaces 2.3-next

API
1318 kb 1043 kb
IMPL 3495 kb (combined) 2712 kb 2384 kb

Dependencies
241 kb (beanutils)
141 kb (digester)
TOTAL 3495 kb 4412 kb 3427 kb



Performance:
NOTE: this is not a full benchmark, it's only a single case to demonstrate the difference between MyFaces 2.3 and MyFaces 2.3-next, which was inspired from: https://www.oio.de/public/java/studie-jsf-mojarra-myfaces-performance-vergleich.htm
We have to rerun https://github.com/lu4242/performance-comparison-java-web-frameworks later for a real comparison between MyFaces and Mojarra.


Mojarra 2.3 MyFaces 2.3 MyFaces 2.3-next
GET input.xhtml Average: 67 ms Average: 62 ms Average: 43 ms
POST input.xhtml Average: 115 ms Average: 122 ms Average: 108 ms
GET detail.xhtml Average: 119 ms Average: 124 ms Average: 103 ms
POST detail.xhtml Average: 70 ms Average: 54 ms Average: 43 ms
TOTAL Average: 92 ms
Throughput: 198.7/s
Average: 91 ms
Throughput: 209.8/sec
Average: 74 ms
Throughput: 264.2/sec

This means that MyFaces 3.0 is up to ~15% faster as the already very fast MyFaces 2.3 in this case.
We also did some memory finetuning - i just don't have any numbers right now.

Tuesday, February 5, 2019

Maven: use lombok combined with OpenJPA metadata generation

Here is a example how to use lombok combined with OpenJPA metadata generation inside the maven-compiler-plugin:
    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.0</version>
        </dependency>

        <!-- needs to be defined here for the annotation processor -->
        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>3.0.0</version>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <annotationProcessors>
                            <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
                            <annotationProcessor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</annotationProcessor>
                        </annotationProcessors>
                        <compilerArgs>
                            <arg>-Aopenjpa.metamodel=true</arg>
                            <arg>-Aopenjpa.source=7</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>