[EJB 3.0] - How to speed up your remote EJB calls
by javajedi
I've been doing some profiling of our remote EJB3 invocations, and I just wanted to post and share what I found out. I was able to achieve an average 50% performance boost for our remote calls by changing 1 line in deploy/ejb3.deployer/META-INF/jboss-service.xml:
Original line:<attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
New line:<attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?serializationtype=jboss&socket.check_connection=false</attribute>
JBoss serialization gives a really nice performance boost. However, I did run into a bug in JBoss AOP when I enabled it. I posted a patch for this at http://jira.jboss.com/jira/browse/JBAOP-347.
The other change that gave an almost equally impressive boost was the check_connection=false bit. The socket transport sends a 1 byte ping to the server and waits for a 1 byte response before handing the socket back to the client from the pool. So because of this, every remote invocation actually involves 2 round trips by default. Adding this parameter to disable this check shaves a few milliseconds off of each remote call, on average.
However, this does seem to cause a problem in that, once the socket connection times out (default configuration value is 1 minute), the subsequent remote call fails on the client side, because it tries to reuse the closed socket connection. The call after this is fine because it gets a fresh connection. So to resolve this, I increased the socket connection timeout to 10 minutes (timeout=600000), and created a custom client-side interceptor that wraps the invocation, checks for an IOException, and retries the call once when it happens.
This seems to be working pretty well, and is significantly faster. If anyone has any suggestions for how to squeeze some more performance out of the transport, or sees anything potentially wrong with what I'm doing, I'd appreciate hearing about it. :)
--Tim
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004109#4004109
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004109
19 years, 3 months
[JBoss Portal] - Re: jboss-portal-2.6-ALPHA1-bundled with Oracle
by jboss@biancashouse.com
This is a work in progress, but the following is a checklist of things that make Portal work with Oracle.
Hope it is helpful to you... Ian
Installed using jem installer 1.2.GA
Datasource is Oracle thin driver, with username jbportal241
Portal-2.6-alpha1
Changes made to get Portal working with Oracle
==============================================
Using oci rather than thin driver
---------------------------------
It is recommeded we use the oci style of connection.
The latest oci drivers can be downloaded from Oracle.
You have to unzip the download into a directory and add that directory to the windows path.
You also have to copy the ojdbc.jar to the lib directoy for your deployment directory.
If you already had an Oracle client, you'll need to rename a property in your windows
registry:
\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG
Use a later version of Apache JackRabbit
----------------------------------------
In portal-cms.sar, replace jackrabbit-core-1.0.jar with jackrabbit-core-1.1.1.jar
Edited portal-cms.sar/META-INF/jboss-service.xml to make use of OracleFileSystem
that is now available in the newer jackrabbit API. Note - the oracle username
and password are found in the new file.
Moved portal-cms.war into portal-cms.sar
Workarounds for bugs in Oracle's JDBC driver
--------------------------------------------
See http://forum.hibernate.org/viewtopic.php?t=82
and http://forum.hibernate.org/viewtopic.php?t=930650
and http://jira.jboss.com/jira/browse/JBAS-191
Gavin King reminds us that Oracle don't handle out-join-fetching properly, and
recommends we disable it. So I found how to do this in the Hibernate reference docs:
http://www.hibernate.org/hib_docs/reference/en/html/session-configuration...
3.4.2. Outer Join Fetching
--------------------------
If your database supports ANSI, Oracle or Sybase style outer joins, outer join fetching
will often increase performance by limiting the number of round trips to and from the
database (at the cost of possibly more work performed by the database itself).
Outer join fetching allows a whole graph of objects connected by many-to-one, one-to-many,
many-to-many and one-to-one associations to be retrieved in a single SQL SELECT.
Gavin King informs us that Oracle doesn't handle out-join-fetching properly, and
recommends we disable it. So I found how to do this in the Hibernate reference docs:
http://www.hibernate.org/hib_docs/reference/en/html/session-configuration...
Outer join fetching may be disabled globally by setting the property hibernate.max_fetch_depth to 0.
A setting of 1 or higher enables outer join fetching for one-to-one and many-to-one
associations which have been mapped with fetch="join".
See Section 19.1, ?Fetching strategies? for more information.
So I add the following lines:
org.hibernate.dialect.Oracle9Dialect
0
to hibernate.cfg.xml in these directories:
jboss-portal.sar/conf/hibernate/instance
jboss-portal.sar/conf/hibernate/portal
jboss-portal.sar/conf/hibernate/portlet
jboss-portal.sar/conf/hibernate/user
jboss-portal.sar/portal-cms.sar/conf/hibernate/cms
Bug in SQL generation from Hibernate mappings
=============================================
Table JBP_OBJECT_NODE does not get generated due to the following SQl being generated:
create table JBP_OBJECT_NODE (
PK number(19,0) not null,
PATH varchar2(255 char) unique,
NAME varchar2(255 char),
PARENT_KEY number(19,0),
primary key (PK), unique (PATH)
)
remove unique="true" from the PATH column mapping in jboss-portal.sar/conf/hibernate/portal/domain.hbm.xml
This bug also applies to the mapping for JBP_INSTANCE, so remove the same entry from:
jboss-portal.sar/conf/hibernate/instance/domain.hbm.xml
Oracle CLOB mapping problem
===========================
Refer to the JIRA: http://jira.jboss.com/jira/browse/JBAS-191
... please ensure that you are using the absolute latest Oracle 9.2 JDBC drivers, even if your database is Oracle 8. Also, you must use the
"OCI" variant if you want to store LOB's greater than about 4k...
Refer to Oracle's description of the CLOBS: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/c...
I have download the latest oracle 10g R2 jdbc driver 10.2.0.2
Workaround for Oracle version of JBoss Forums
---------------------------------------------
apply the same as above to hibernate.cfg.xml in jboss-forums.ear/portal-forums.sar/conf
Jboss Forums ear has a bug - missing Faces listener
===================================================
Add the following listener to jboss-forums.ear/portal-forums.war/WEB-INF/web.xml
<!-- MyFaces -->
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
Changed the deployment xml so that ForumsPortlet not deployed - just JSFForumsPortlet
NOTE - Forums won't work with Portal Alpha1 - class cast exception - waiting for someone to identify that problem - use Portal 2.6DR is you need Forums
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004097#4004097
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004097
19 years, 3 months