Jan 7, 2016

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

Mike Hostetler profile.

Mike Hostetler

Principal Technologist

Mike has almost 20 years of experience in technology. He started in networking and Unix administration, and grew into technical support and QA testing. But he has always done some development on the side and decided a few years ago to pursue it full-time. His history of working with users gives Mike a unique perspective on writing software.

One thought on “Changing the embedded server in Grails 3

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Structuring SwiftUI Previews for API Calls
SwiftUI, together with Combine and Xcode 11+, provide a powerful toolset for quickly creating an app with a native UI. In Xcode 11+, the preview pane was introduced in order to provide live snapshots of […]
Seamlessly Integrating Micro Apps with iFrame
A recent client wanted to upgrade a small portion of their legacy application with a more modern UI and extra functionality, like fuzzy text search. There are a few approaches to incremental upgrades of legacy […]
Consul on Docker EE
[markdown]”Consul is a service networking solution to connect and secure services across any runtime platform and public or private cloud” – [https://consul.io](https://consul.io) This post details a way to run a Consul cluster on Docker EE […]
Passing the AWS Machine Learning Speciality Exam
The Amazon Machine Learning Specialty Exam is a 3-hour, 65 question test. It is designed to test your skills in AWS specific Data Engineering and Machine Learning Practices along with Machine Learning in general. I […]