Need to know the reason behind the flattish behaviour of memory utilization of Linux based App Service Plan

Nayan Chhabhaiya 10 Reputation points
2025-06-05T14:42:02.4833333+00:00

Current scenario: As show in the below attached screenshot, the memory utilization of Linux based App Service Plan is flattish even after the function executions are completed on the Azure Function Apps hosted on App Service Plan (dedicated) and not coming down.

Linux based App Service Plan's usage

Same behavior (flattish memory utilization and not frequently coming down) can be seen in the Memory working set of the Azure Function App.

Azure Function App's Memory working set metrics

Expected behavior: Once the Function execution gets completed, the memory utilization should come down instead of remaining flattish (same as CPU utilization).

Queries:

  • Please help me in understanding the strange behavior of memory utilization of Linux based App Service Plan.
  • Is there any way to tweak the memory utilization behavior of Linux based App Service Plan?
Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
262 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 5,970 Reputation points Microsoft External Staff Moderator
    2025-06-09T09:53:53.6733333+00:00

    @Nayan Chhabhaiya ,

     Thanks for your follow-up!

     The flat memory usage you’re observing on the Linux-based App Service Plan is expected. When garbage collection (GC) runs in Java (or other runtimes), it frees up unused memory within the JVM, but that memory is not immediately released back to the OS. Instead, it stays allocated for future use, which is why you see memory usage remaining flat even after function execution.

    For Java Function Apps, here are some recommendations:

    • Choose the right GC and use G1GC (default), or consider ZGC for low-latency needs.
    • You can Set fixed heap sizes: e.g., -Xms512m -Xmx1024m to keep memory predictable.
    • Enable GC logging it helps analyse memory behaviour (-Xlog:gc*).
    • Enable Always On it Improves performance and avoids cold starts.
    • Use performance flags Like -XX:+TieredCompilation and -XX:+AlwaysPreTouch.

    These steps could help you manage memory more efficiently, even if the OS metrics don’t show immediate drops in usage. Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.