Changing the embedded server in Grails 3

I have a pet project that I’ve written in Grails 3. I run it on an already-busy cloud server via the fat jar. I kept the default Tomcat configuration but soon I kept getting out of memory errors. I wanted to use something more lightweight. So I started looking how to change out Tomcat for something else in Grails 3, but I couldn’t find anything. But Grails 3 is just Spring Boot, right?

I found this page on in the Spring Boot docs about changing from Tomcat to Undertow. I’ve used Undertow before and I really liked it. The documentation didn’t quite match what I had in my build.gradle file but it was really pretty easy. I simply changed this line:

compile "org.springframework.boot:spring-boot-starter-tomcat"

 

to this:

compile "org.springframework.boot:spring-boot-starter-undertow"

 

And that was it — I recompiled and redeployed… and haven’t had a memory problem since. That was two months ago. The only difference I’ve seen is that dbconsole doesn’t work while running in development mode, but that’s not a big deal to me.

About the Author

Object Partners profile.

One thought on “Changing the embedded server in Grails 3

Leave a Reply

Your email address will not be published.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]