Comments (8)
Hm... I was trying different options, but I couldn't make them work well:
- jmh - special type of tests, when Spring container (and all its View Resolvers) is not completely initialized. About half of view resolvers simply don't work;
- Gatling - uses newer Scala, with it Scalate adds dependencies to wrong folder, and Tomcat's Jar scanner tries to search them in the wrong places (I know it sounds weird, but you can simply change Scala from 2.11 to 2.12, and rebuild & run the project). However, Scalate still works well, but throws exceptions (weird, isn't it?!), but Gatling reports cannot product the picture similar to what we have in README.md. Either all results are aggregated, or requests are measured using average (or percentile) timings, where we need "totals" only. And instead of having a single table, Gatling produces many charts...
Well... I don't know. I was trying to play with Groovy and JMH, it collides with the Java project and tries to compile code that we don't need to the load/performance tests. I don't see anything better than using Apache Benchmark. Maybe automate it with a simple groovy script or shell, or python, or something simple.
@jreijn, here I feel helpless. Maybe you can give you a try. If you want, I can create a "gatling" branch, so you can see it, but I don't know any better solution.
from spring-comparing-template-engines.
@Vest thanks. Sorry that I have not given this project much time. With the new year I'm going to spend some time to improve the project and perhaps we should split the project for benchmarking the template engines (just the engines) with JMH.
from spring-comparing-template-engines.
I saw one project somewhere in github, where these engines were tested without any web stack. So just raw template in, and raw HTML out. But I don't know if this is a fair comparison, between engines, because some of them might have weak points such as concurrency, caching, or I/O.
from spring-comparing-template-engines.
I have successfully configured the spring-comparing-template-engines with JMH working correctly with Spring MVC and all template engines of this project, except for JSP.
This way we are evaluating the performance of the Spring MVC stack with each template engine and discarding the overhead of the HTTP conversation.
To that end, I am using MockMvc
built from class Launch
and then I am performing requests in the same way as you presented in test PresentationsIT
. I have distinct benchmark methods for each template engine evaluated in isolated trials with a fresh instance of SpringApplication, configured as:
@Setup(Level.Trial)
public synchronized void startupSpring() {
try {
if (context == null) {
context = SpringApplication.run(Launch.class);
mockMvc = MockMvcBuilders
.webAppContextSetup((WebApplicationContext) context)
.build();
}
} catch (Exception e) {
//Force JMH crash
throw new RuntimeException(e);
}
}
@TearDown(Level.Trial)
public synchronized void shutdownSpring() {
try {
if (context != null) {
SpringApplication.exit(context);
context = null;
}
} catch (Exception e) {
//Force JMH crash
throw new RuntimeException(e);
}
}
IMHO this is the most effective approach to benchmark the Spring MVC with different template engines. We have all the advantages of JMH with reliable isolation, measurement, warm-up, etc. The only drawback is that we are unable to test JSP.
In truth, JSP runs without errors, but the response content is empty, and we cannot effectively measure that engine because the Spring MVC Test doesn't run that servlet container (https://stackoverflow.com/a/37749746/1140754)
If you consider it useful, I can make a PR with my fork. Also, I included new unit tests to check whether the engines are returning the correct HTML. Those tests allowed me to understand that JSP was not rendering anything.
from spring-comparing-template-engines.
Hi @fmcarvalho . Thanks for sharing the information. I'm definitely interested in your efforts. If you are willing to share or create a PR I would love to learn more.
With regards to JSP I ran into something similar when trying to write a test for it.
from spring-comparing-template-engines.
from spring-comparing-template-engines.
@jreijn Any news?
from spring-comparing-template-engines.
@fmcarvalho sorry for the late reply! I'll try to take a look at this weekend.
from spring-comparing-template-engines.
Related Issues (20)
- Dependency org.yaml:snakeyaml, leading to CVE problem HOT 1
- Add Rythm to Benchmark HOT 5
- JSP context path with c:url HOT 1
- Should we use caching, or disable it HOT 6
- Freemarker 2.3.23 vs Thymeleaf 3.0.0BETA02 vs Velocity 1.7 vs JSP (latest builds as of March, 2016) HOT 5
- Update Thymeleaf to version 3.0 HOT 3
- Update Benchmark to Jade4J 1.2.3 HOT 6
- Update the project to Tomcat 8 and Java 8 HOT 5
- Add support for groovy-templates HOT 1
- Falsy demo urls in README HOT 1
- Add Ickenham to Benchmark HOT 1
- Add HtmlFlow HOT 1
- Add Rocker to benchmark HOT 4
- Is spring mvc (spring boot + tomcat) too slow? HOT 9
- Upgrade HtmlFlow to release 3.5 HOT 1
- Add kotlinx.html HOT 1
- Thank you HOT 5
- Upgrade project to Spring Boot 2.4 HOT 1
- Global cache flag: Should have a two runs with cache enabled and cache disabled. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-comparing-template-engines.