Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43849

Wiki Page: VBC 5.x: Questions about the details of shared memory implementation in Visibroker

$
0
0
Problem: Product Name: VisiBroker C++ Product Version: 5.x and above Product Component : Shared Memory IPC Platform : HP, AIX and Linux Q1. When does a process attach & detach to shared memory ( shmat & shmdt )? Q2. Creating two POA's in each process. Each POA has two server engines, one for LIOP and another for IIOP. But there are four SHMEM segments created for a particular pid. Why are four segments created ( shmget ) ? Also, how are the 4 segments created and where do they map to in the applicaiton (interested in why not only 1 segment is created, and why 4 segments are created) ? Q3 . How does Visibroker shared memory implementation handle the application initialization (attach/detach), and after initialization is done how is the actual client and server communication handled? Q4 . Can any performance or scalability issues arise because all applications are communicating with all the other applications during startup ? Q5. Are there any suggestion on how to handle abnormal termination crashed with different signal's of application, so that there won't be any system resource problem? Resolution: A1. The shmat is done during the creation of the listener which typically happens when the resolve_initial_references("RootPOA") is called. shmdt called is when the listener is destroyed either through ORB::destroy method or process exit. A2. The Unix domain socket might be using shared memory internally. So it could be two shared memory and two by the Unix domain socket. A3. The connection is done through Unix domain socket. When the client makes invocation, if the LIOP connection exists, and no other thread is using the shared memory, the request invocation is send through the shared memory using semaphore as signaling mechanism. The thread will wait for the reply. Any other thread trying to make invocation while the shared memory is busy will fall back to Unix domain socket. So the shared memory is always used in conjunction with the Unix domain socket. A4. When a thread in a process is using the shared memory, no other threads in the process or other process can access it. They will go through the Unix domain socket instead of waiting for the invocation to complete. So there should not be any performance or scalability issue. A5. After the server process coredump happens, the shared memory and semaphore related resources that need to be reclaimed have the name with pid (e.g. orb_ pid _N.shm and orb_ pid _N.sem) in the temp file. The following VisiBroker properties could be useful: i) vbroker.se.default.local.listener.shmSize= value (default to 1 system page) If the client payload is greater than this value, it will fall back to Unix domain socket. ii) vbroker.se.default.local.listener.shm= true | false (to enable shared memory in Unix, default true)    (Turning off local ipc by "-OAlocalipc 0 " option will disable the shared memory as well.) iii) vbroker.orb.enableShmIPC= true | false (default true) This is a client side property. Some additional information: The shared memory is used in HP, AIX and Linux LIOP by default. The shared memory region is created during the server process startup. The default size of it is 4096 or 1-page-file size, whichever is bigger. But it can be adjusted using the property as: vbroker.se.default.local.listener.shmSize= new value Once the shared memory region is created, its size is not changed throughout the session. If the server is shutdown using Ctrl-C (signal 2 and 15), or through orb- shutdown, the shared memory gets deleted properly. If killed using -9 signal, the server cannot cleanup the shared memory. It internally uses semaphores (System V) to signal while using the shared memory. Abnormal termination may cause the system to run out of total available semaphores, in which case the shared memory channel will not be effective. The user application will not receive any warning or exception. The client does not attempt to send through shared memory if the payload size is bigger than the shared memory size. It uses the Unix Domain socket in such cases. If sending through the shared memory fails with any reason, it always falls back to Unix domain socket. The shared memory channel can be disabled by using the following property during Server startup : vbroker.se.default.local.listener.shm=false

Viewing all articles
Browse latest Browse all 43849


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>