How to limit the size of memory for a single thread?



      I started 4 ports for http request, details configration in sm.cfg as follows:


  •  #web client

sm -httpPort:13080 -sslConnector:1 -httpsPort:13443 -ssl:1 -querysecurity:0 -ldapdisable:1


  • #windows client

sm -httpPort:13081 -sslConnector:0 -ssl:0


  • #hp cit

sm -httpPort:13088 -sslConnector:0 -ssl:0 -ldapdisable:1 -log:../logs/hpcit/hpcitrequest.log -maxlogsize:26214400 -numberoflogfiles:7


  • #mobile

sm -httpPort:13086 -sslConnector:0 -ssl:0 -ldapdisable:1 -rtm:2 -debughttp:1 -log:../logs/mobile/mobile.log -maxlogsize:26214400 -numberoflogfiles:7


I found that performance of the SM server will be poor when one of theads take a lot of memory, e.g. 1.5GB. theads list as follows:

I fond the second thead take about 1.5GB memory yesterday, I want to limit the max size of per SM thead, please help!!!

  • Hello,

    I don't understand what is actual problem. thus Can you answer and provide information for clarification?

    1. As a captured file, second process size is almost 520MB. Did it reach 1.5GB?
    2. You told about four (#web client, #windows client, #hp cit and #mobile) configuration. Which sm.exe recame bigger size?
    3. Have you seen same symptom before?
    4. Version information

    You can see the following memory related logs when a parameter is configured in SM 9.21.113 and later (7.11.303 and later)

      JRTE D Name: Eden Space Max:(26869760) Used:(2666664)  %Used(9.0)
      JRTE D Name: Survivor Space Max:(3342336) Used:(1100920)  %Used(32.0)
      JRTE D Name: Tenured Gen Max:(67108864) Used:(0)  %Used(0.0)
      JRTE D JavaMemory Max(67108864) Used(0) %Used(0.0)
      JRTE D NativeMemory Max(2147352576) Used(356306944) %Used(16.592848)

    You can gather memory information by '' if you kave already known which sm.exe consume a large memory.
    The below is an example when  your sm.exe for '#windows client' consumes large memory size.

        sm -httpPort:13081 -sslConnector:0 -ssl:0 -log:xxxxxxxxxxxxxxxxxxxx

    When number of client is many, sm.exe may use large memory. It is not defect. If so, it is prformance issue and consulting issue. I will say to introduce vertical scaling if there is no problem.



  • Hi,

    > I fond the second thead take about 1.5GB memory yesterday, I want to limit the max size of per SM thead, please help!!!

    A log in the sm.log file says detail if a parameter is configured.
    Maximum memory size is 2GB if your Windows OS is 32 bit.

     KM832163 How to turn ON detailed messages of the memory monitoring thread

    A document 'Monitoring memory in Service Manager processes' on the help server (9.31) says the below.
    Monitoring memory in Service Manager processes

    The Service Manager process embeds a Java Virtual Machine (JVM) so that the heap memory provided by the operating system for any process is partitioned into a Java Heap and a Native Heap. The Service Manager process self?monitors these heaps and takes action to prevent a crash.

    During startup of a Service Manager process, immediately after the JVM is created, a memory monitor thread is started, which will poll for a low memory condition every 15 seconds. On every iteration, the memory monitoring thread fetches the current usage of java heap (all platforms) and native heap (Windows only) and set the process global flags lowMemoryOnJava and lowMemoryOnNative when the usage exceeds 90% of allocated memory in that category. These flags are unset again when the usage of memory drops below 70%.

    To prevent server crashes due to low available heap memory and to avoid disrupting users who are logged on to a Service Manager process, the servletcontainer takes the following actions when the low memory flags are set:

        Writes warning messages to sm.log.
        Notifies LoadBalancer not to send that servlet any new client connections.
        Denies new client sessions (Windows client, web client or web services client) for that servlet. They are sent to another one.
        Does not allow existing clients to open new tabs. However, they can trade the existing tabs for new ones. For example, if you close two tabs, you will be allowed to open two new tabs. If you cannot operate without opening any new tabs you need to logoff and login again.

    Normal processing is resumed when the heap usage drops below 70%. The servletcontainer takes the following actions when the low memory flags are unset.

        Writes Info messages to the sm.log file indicating normal memory usage.
        Notifies LoadBalancer to resume sending of new client connections.



  • Hi Jelly,


    We refer to those sm commands as servlets. You can only control the Java Virtual Memory assigned to those servlets. If you set the parameters in sm.ini, it will applies to all servlets. If you set those parameters on the individual sm line in sm.cfg, it will only applies to that sm servlet and overrides what's been set in sm.ini.


    Have a look at for the parameters and example. You cannot allocate more memory than you have but restricting should be ok. It should not be more than 1.2 G for Windows, Unix can be higher. Be careful and test because if you get the syntax wrong or set it too low, it could results in SM not starting or you start getting lots of low on memory or out of memory error messages.


  • If anyone ever end up on this old thread, there's this parameter to do the job.




    This parameter specifies the maximum memory (in MB) allowed for a session. After the limit is reached, the session is terminated. By default, this parameter is disabled (set to 0), which means there is no memory limit for each session and therefore each session can use the maximum memory available to the server's operating system.

    Note This parameter is only applicable when the utallocmode parameter is set to 0

  • Limit won't help you. We also experienced the same situation and it is a issue. There is some memory leak in the application and yes, it's a bug present in all versions I've been working with. The workaround is restart the servlet. So setup a monitoring on yours SM.exe and restart the servlet every time it reaches 1.5GB to avoid downtime.
  • Thanks for the info & solution, Breno. For my information, when you said "all versions", does that include SM 9.63 and 9.64 ?

    I have a customer on 9.52P5 which I think your solution would help.