All Projects → jreijn → Spring Comparing Template Engines

jreijn / Spring Comparing Template Engines

Licence: apache-2.0
Demo project to show different Java templating engines in combination with Spring MVC

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Comparing Template Engines

Spring Boot File Upload Download Rest Api Example
Spring Boot File Upload / Download Rest API Example
Stars: ✭ 300 (-20.42%)
Mutual labels:  spring-mvc
Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (-14.32%)
Mutual labels:  spring-mvc
Ssm booksystem
ssm demo,ssm详细教程,SSM简明教程:简单的十步教你搭建人生第一个SSM框架[ SSM框架整合教程(spring+spring mvc+mybatis+redis+maven+idea+bootstrap) ]
Stars: ✭ 355 (-5.84%)
Mutual labels:  spring-mvc
Manong Ssm
基于SSM框架的Java电商项目
Stars: ✭ 306 (-18.83%)
Mutual labels:  spring-mvc
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (-14.32%)
Mutual labels:  template-engine
Pug
Pug template engine for PHP
Stars: ✭ 341 (-9.55%)
Mutual labels:  template-engine
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (-21.75%)
Mutual labels:  template-engine
Webbf
Java Web工程demo 后端:spring + spring mvc + mybatis + maven,涉及定时任务quartz、ehcache缓存、RESTful API、邮件发送... 前端:react + reflux + webpack,涉及ES6、jquery、react-router、ant design等内容, 提供下思路,仅供参考。
Stars: ✭ 367 (-2.65%)
Mutual labels:  spring-mvc
Efo
EFO是一个基于SpringBoot和Vue构建的文件分享系统,包括文件的上传与下载,文件的权限管理,远程文件管理等功能。
Stars: ✭ 327 (-13.26%)
Mutual labels:  spring-mvc
Spring Rest Exception Handler
A convenient Spring MVC exception handler for RESTful APIs.
Stars: ✭ 351 (-6.9%)
Mutual labels:  spring-mvc
Angularjs Springmvc Sample Boot
A RESTful sample using Spring Boot, Spring MVC, Spring Data and Angular/Bootstrap.
Stars: ✭ 309 (-18.04%)
Mutual labels:  spring-mvc
Slime
Minimalistic HTML templates for Elixir, inspired by Slim.
Stars: ✭ 315 (-16.45%)
Mutual labels:  template-engine
Thymeleaf Spring
Thymeleaf integration module for Spring
Stars: ✭ 349 (-7.43%)
Mutual labels:  template-engine
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+772.94%)
Mutual labels:  template-engine
Quick4j
Use quick4j build simple,fast,ahead and flexible JVM-based systems and applications.
Stars: ✭ 358 (-5.04%)
Mutual labels:  spring-mvc
Http Rpc
Lightweight REST for Java
Stars: ✭ 298 (-20.95%)
Mutual labels:  template-engine
Webkettle
基于web版kettle开发的一套分布式综合调度,管理,ETL开发的用户专业版B/S架构工具
Stars: ✭ 334 (-11.41%)
Mutual labels:  spring-mvc
Markupsafe
Safely add untrusted strings to HTML/XML markup.
Stars: ✭ 367 (-2.65%)
Mutual labels:  template-engine
Squirrelly
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
Stars: ✭ 359 (-4.77%)
Mutual labels:  template-engine
Jetbrick Template 2x
Template Engine for Java
Stars: ✭ 351 (-6.9%)
Mutual labels:  template-engine

Comparing Template engines for Spring MVC

Build Status

This is a demo project, which accompanied my "Shoot-out! Template engines for the JVM" presentation, which shows the differences among several Java template engines in combination with Spring MVC. Template engines used in this project are:

Build and run

You need Java 8 and Maven 3 to build and run this project. Build the project with

mvn package

Run the project with

mvn spring-boot:run

See the demo URLs:

Benchmarking

In case you want to benchmark the different template engines I would recommend using Apache HTTP server benchmarking tool or Siege an HTTP/HTTPS stress tester. You can try any of the following URLs.

$ ab -n 10000 -c 10 http://localhost:8080/jsp
$ ab -n 10000 -c 10 http://localhost:8080/velocity
$ ab -n 10000 -c 10 http://localhost:8080/freemarker
$ ab -n 10000 -c 10 http://localhost:8080/thymeleaf
$ ab -n 10000 -c 10 http://localhost:8080/mustache
$ ab -n 10000 -c 10 http://localhost:8080/jade
$ ab -n 10000 -c 10 http://localhost:8080/pebble
$ ab -n 10000 -c 10 http://localhost:8080/handlebars
$ ab -n 10000 -c 10 http://localhost:8080/jtwig
$ ab -n 10000 -c 10 http://localhost:8080/scalate
$ ab -n 10000 -c 10 http://localhost:8080/httl
$ ab -n 10000 -c 10 http://localhost:8080/chunk
$ ab -n 10000 -c 10 http://localhost:8080/htmlFlow
$ ab -n 10000 -c 10 http://localhost:8080/trimou
$ ab -n 10000 -c 10 http://localhost:8080/rocker
$ ab -n 10000 -c 10 http://localhost:8080/ickenham
$ ab -n 10000 -c 10 http://localhost:8080/rythm
$ ab -n 10000 -c 10 http://localhost:8080/groovy
$ ab -n 10000 -c 10 http://localhost:8080/liqp
$ ab -n 10000 -c 10 http://localhost:8080/kotlinx

For creating the below benchmark results I used ApacheBench (version 2.4.25) with the following settings:

ab -n 25000 -c 25 -k http://localhost:8080/jsp

With 25 concurrent requests and 25.000 requests in total this resulted in the following numbers:

Benchmarks 2018

These tests were done on a local machine with the following specs:

Spring-Boot: 2.1.2.RELEASE
Windows 10 (1803, build: 17134.523)
3,60 GHz Intel Core i5-8350U Quad core
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
Apache Tomcat 9.0.14

Results in order (high to low):

Total time taken for processing 25.000 requests with a concurrency level of 25 (lower is better).

Jade4j                  567.7 seconds
Handlebars              147.7 seconds
Scalate - Scaml         33.33 seconds
Pebble                  27.92 seconds
HTTL                    24.61 seconds
Thymeleaf               24.09 seconds
Velocity                23.07 seconds
Freemarker              11.80 seconds
jTwig                   10.95 seconds
Mustache (JMustache)    8.836 seconds
JSP                     7.888 seconds

Benchmarks 10.2019

These tests were done on a local machine with the following specs:

Spring-Boot: 2.1.4.RELEASE
Windows 10 (1803, build: 17134.706)
3,60 GHz Intel Core i5-8350U Quad core
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
Apache Tomcat 9.0.17

Results in order (high to low):

Total time taken for processing 25.000 requests with a concurrency level of 25. (lower is better)

Groovy                  ~ 800 seconds
Jade4j                  684.7 seconds
Handlebars              161.8 seconds
Scalate - Scaml         34.38 seconds
Velocity                27.49 seconds
Pebble                  25.63 seconds
HTTL                    22.86 seconds
jTwig                   21.23 seconds
Liqp                    19.60 seconds
Ickenham                19.50 seconds
Thymeleaf               18.33 seconds
Rythm                   17.84 seconds
Rocker                  17.63 seconds
Mustache (JMustache)    15.75 seconds
HtmlFlow                15.62 seconds
Chunk                   15.04 seconds
Trimou                  15.02 seconds
Freemarker              14.74 seconds
JSP                     11.22 seconds

Keep in mind that in the real world, these results will differ depending on the complexity of the templates, hardware, etc, so it's just an indication and if you want to know the truth you will have to run the benchmark yourself to see how such a template engine performs in your specific environment.

Chunk produces pages with variable length. I haven't investigated it yet. ab might fail, and for Chunk use:

$ ab -n 25000 -c 25 -l http://localhost:8080/chunk

How were the results measured?

Before the performance of each template engines was measured, there were at least 2 dry runs with the exact same settings, to make sure that initialization of the engines, warm up of the JVM and additional caches have taken place. There were at least 5 iterations of the same benchmark before calculating the average time it took.

For Mac OS X users

Mac OS X has only 16K ports available that won't be released until socket TIME_WAIT is passed. The default timeout for TIME_WAIT is 15 seconds. Consider reducing in case of available port bottleneck.

You can check whether this is a problem with netstat:

# sysctl net.inet.tcp.msl
net.inet.tcp.msl: 15000

Now if you want to change this you can do so by doing:

# sudo sysctl -w net.inet.tcp.msl=1000
net.inet.tcp.msl: 15000 -> 1000

In case you still run into problem you might want to read this thread on ephemeral ports.

Contributing

In case you see an improvement to the benchmark or know about ways to improve the results, please file an issue and send a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].