Summary: Setting communication protocol using exporters;
GenericExporter configuration - ports, connections, and threads.
OverviewGigaSpaces provides a pluggable communication adaptor, LRMI (Light Remote Method Invocation). GigaSpaces LRMI is built on top of NIO communication protocol. The GenericExporter, that implements the net.jini.export.Exporter interface, controls the whole network infrastructure, wraps the LRMI layer, and allows the application to use LRMI transparently. All of GigaSpaces components that represent remote objects/services (for example: Transaction Manager, Lookup Service, Mahalo, GSM, GSC, space, and container) use the GenericExporter (that can be easily replaced with a custom, user-defined exporter). GigaSpaces provides the GenericExporter as its default exporter, which works with LRMI. However, it is possible to use GigaSpaces with other exporters instead:
Changing the default exporter is done by editing the <GigaSpaces Root>\config\services\services.config file. For example, to change the default exporter from GenericExporter to JrmpExporter: Change: { ... // uncomment the following next line to use Jrmp exporter instead of GenericExporter // defaultExporter = new net.jini.jrmp.JrmpExporter(); defaultExporter = new com.gigaspaces.lrmi.GenericExporter( nioConfig ); } to: { ... // uncomment the following next line to use Jrmp exporter instead of GenericExporter defaultExporter = new net.jini.jrmp.JrmpExporter(); } GenericExporter Configuration
com.gigaspaces.transport { bindHost = BootUtil.getHostAddressFromProperty("java.rmi.server.hostname"); //To define the port range change the following line to: //bindPort = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.bind-port", BootUtil.getPortInRange(10000, 20000) ) ); bindPort = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.bind-port", "0") ); minThreads = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.min-threads", "1") ); maxThreads = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.max-threads", "128") ); maxConnPool = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.max-conn-pool", "1024") ); readSelectorThreads = Integer.parseInt( System.getProperty("com.gs.transport_protocol.lrmi.selector.threads", "1") ); //LRMI Watchdog parameters watchdogRequestTimeout = System.getProperty("com.gs.transport_protocol.lrmi.request_timeout", "30s"); watchdogListeningTimeout = System.getProperty("com.gs.transport_protocol.lrmi.listening_timeout", "5m"); watchdogIdleConnectionTimeout = System.getProperty("com.gs.transport_protocol.lrmi.idle_connection_timeout", "15m"); //LRMI ThreadPool idle timeout default is 5 min. threadPoolIdleTimeout = Long.parseLong(System.getProperty("com.gs.transport_protocol.lrmi.threadpool.idle_timeout", "300000")); //LRMI timout on the Socket connect. Default connect timeout in seconds is 0 - infinite timeout socketConnectTimeout = System.getProperty("com.gs.transport_protocol.lrmi.connect_timeout", "0"); nioConfig = new com.gigaspaces.config.lrmi.nio.NIOConfiguration( minThreads, /* min executors threads */ maxThreads, /* max executors threads */ maxConnPool, /* maxConnPool */ bindHost, /* if null resolves to the localhost IP address */ bindPort, /* if 0 any next free port will be used for incoming client requests.*/ readSelectorThreads, watchdogRequestTimeout, watchdogListeningTimeout, watchdogIdleConnectionTimeout, threadPoolIdleTimeout, socketConnectTimeout ); // uncomment the following next line to use Jrmp (RMI) exporter instead of GenericExporter (NIO based) // defaultExporter = new net.jini.jrmp.JrmpExporter(); defaultExporter = new com.gigaspaces.lrmi.GenericExporter( nioConfig ); }
You might want to define different options for different remote services. This can be done using system properties. For example, if you are working with NFS (Network File System), where all machines in the network are using one GigaSpaces installation installed on a central machine, the client and server use the same port defined in the GenericExporter bindPort argument. To override this, you can define the java.rmi.server.hostname system property as the bindPort value in the central machine, thus enabling the client and server to define their own port.
OptionsThe GenericExporter configuration options are detailed below. Remember that you can override all of them using system properties, as described in the section above.
Defining Socket Port Range per JVMIt is possible to define a range of ports using the bindPort argument, meaning that every JVM acquires a bind port from a defined port range. This functionality is useful when having multiple JVMs on the same machine (clients or servers), and simplifies firewall setup. The following method in BootUtils is a utility method which helps to retrieve a free port from a port range: BootUtil.getPortInRange(10000, 20000) To define the port range change the following line in the com.gigaspaces.transport block: bindPort = Integer.parseInt( System.getProperty("com.gigaspaces.transport.bind-port", "0") ); to: bindPort = Integer.parseInt( System.getProperty("com.gigaspaces.transport.bind-port", BootUtil.getPortInRange(10000, 20000) ) ); Instead of 1000, 2000, specify the desired port range (in this case, the port range is between 1000 and 2000). When the JVM is started, the system checks if the com.gigaspaces.transport.bind-port system property is defined. If not, the defined port range is used.
Configuration with Multi-Homed MachinesWhen working with a multi-homed machine (a computer with multiple network cards), use the following system property to bind the GigaSpaces Server on a specified network interface: -Djava.rmi.server.hostname=<hostname or IP address> The value of this property represents the host name string that must be associated with the network interface. The default value of this property is the IP address of the local host, in "dotted-quad" format. TroubleshootingYou can troubleshoot the space activity using LRMI logging. You can turn on LRMI logging in the following modes: Max buffer sizeThe NIO internal cache (a DirectByteBuffer) might cause an OutOfMemoryError due to direct memory exhaustion. -Dcom.gs.lrmi.maxBufferSize (default=640kb) Offline mode – via gs_logging.properties
LRMI communication transport protocol debug messages are displayed. During Runtime – using JMX
When LRMI logging is turned on, the space displays the following when started: To test LRMI logging, you can run the space ping utility using the following command: /bin/gs.bat/space ping mySpace_container mySpace -r -i 1 The space displays the following: The client displays the following: Troubleshooting Tips
CONFIG [com.gigaspaces.grid.gsc]: initialServiceLoadDelay=5000 Exception in thread "LRMI Connection--pool-1-thread-1" java.lang.NullPointerException at sun.nio.ch.PollSelectorImpl.wakeup(PollSelectorImpl.java:84) at com.gigaspaces.lrmi.nio.SelectorThread.registerKey(SelectorThread.java:250) at com.gigaspaces.lrmi.nio.ChannelEntry.workerFinishedReading(ChannelEntry.java:131) at com.gigaspaces.lrmi.nio.Pivot$Worker.dispatch(Pivot.java:111) at com.j_spaces.kernel.WorkingGroup$TaskWrapper.run(WorkingGroup.java:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) note that this is a bug in Sun. For more details, see http://bugs.sun.com.
|
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |