Pages

Monday, May 13, 2013

Muxer Threads


Many Of the Times when there is a Server Crash, We take a Thread dump and analyze the threads running. During that time we see many threads like these
"ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=20 idx=0x68 tid=26709 prio=5 alive, in native, blocked, daemon
    -- Blocked trying to get lock: java/lang/String@0x2b673d373c50[fat lock]
    at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
    at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1675)[optimized]
    at jrockit/vm/Locks.lockFat(Locks.java:1776)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1312)[optimized]
    at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1259)[optimized]
    at jrockit/vm/Locks.monitorEnter(Locks.java:2439)[optimized]
    at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
 These are called “Muxer Threads”. These are the Special Threads in Web logic Server to read incoming request from external entities on the servers. The main usage is to read the incoming request and then pass them to either “execute Thread” or “work Manager”.
Weblogic allocates a percentage of the Thread pool for these pools.The default value is 33% and not more than 50%.
We can assign the value using –Dweblogic.SocketReader=<Value>

Socket Muxer Threads
The Socket Muxer (SM) Threads are threads that manage the existing Server socket connections.
It first checks the sockets and find which socket has an incoming request which needs to be processed ( waiting to be processed).Then It reads data like protocol and then it dispatches the socket that to the run time layer which will process that.
In the run time layer, the SM will identify the Execute Queue that needs to be used for the Socket.
There are 2 types of SM Threads In Weblogic
Native SM & Java SM
Native SM [need to “enable Native I/O” in Weblogic console]: Native SM provides better performance scalability since they use the non blocking thread model. When Native I/O is used the server creates a fixed number of threads especially for reading the incoming socket requests.
Java SM: This uses pure java based threads. These are only available muxer for RMI clients. This is not a suitable one since they blocks on read until there is a data to be read from socket. This can cause bottleneck to the Server.

How can we find which SM is being used?
When we check the Thread Dump,if we see
NTSocketMuxer : Native SM
Weblogic.Socket.Muxer : Java SM