We are currently migrating from Java 8 to Java 17 in a Google App Engine environment, but we're encountering memory leaks that eventually lead to an OutOfMemory (OOM) error. When running the application on a local machine with Java 17, everything works fine. However, in the App Engine environment, where we're using Cloud SQL and Datastore for database access, we are seeing issues. We're looking for recommendations on the best tools to profile memory usage in a Java 17 application running on App Engine's second-generation environment. Any advice on how to integrate memory profiling into this setup would be greatly appreciated.
Hi @mlumbrer,
Welcome to Google Cloud Community!
It sounds like you’re hitting memory issues from the Java 8 to Java 17 migration on App Engine, especially with Cloud SQL and Datastore connections. A few things to try:
I hope the above information is helpful.
Hello Greb
It seems we've identified the issue with the database connection. When using a connection pool, the bulk of the memory leak is resolved. However, since our server is multi-instance and multi-tenant, we might reach the connection limit. I believe there’s a problem with opening and closing connections for each request, as we encountered a similar issue a few years ago. It’s possible that either the database connector or the cloud SQL proxy has a leak during the open-and-close process.