{"id":3209,"date":"2013-08-06T12:18:23","date_gmt":"2013-08-06T17:18:23","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=3209"},"modified":"2013-08-06T12:18:23","modified_gmt":"2013-08-06T17:18:23","slug":"setting-tcpnodelay-on-oracle-xa-datasource-in-jboss","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2013\/08\/06\/setting-tcpnodelay-on-oracle-xa-datasource-in-jboss\/","title":{"rendered":"Setting TCPNODELAY on Oracle XA datasource in JBOSS"},"content":{"rendered":"<p>While troubleshooting performance problems, we wanted to test disabling Nagle&#8217;s algorithm in JBOSS with an Oracle XA datasource.  We found that property was not configurable in the regular Oracle XA class.<\/p>\n<p>We ended up extending the Oracle class to set the property, using what is below.<\/p>\n<pre lang=\"java\">\r\npackage com.express.infra.jdbc;\r\n\r\nimport oracle.jdbc.xa.client.*;\r\nimport java.sql.*;\r\nimport javax.sql.*;\r\nimport java.util.*;\r\n\r\npublic class oracleXADriver extends oracle.jdbc.xa.client.OracleXADataSource {\r\n  String tcpNoDelay;\r\n  public oracleXADriver() throws SQLException {\r\n    System.out.println(\"created com.express.infra.jdbc.oracleXADriver instance.\");\r\n  }\r\n\r\n  public XAConnection getXAConnection(Properties properties) throws SQLException {\r\n    \/\/uncomment to debug, but the properties will show the decrypted password in the server log\r\n    \/*\r\n    System.out.println(\"getting connection with \" + getTcpNoDelay() + \" for a tcpNoDelay value.\");\r\n    System.out.println(properties.toString());\r\n    \/*\r\n    properties.setProperty(\"oracle.jdbc.TcpNoDelay\",getTcpNoDelay());\r\n    return (XAConnection)getPooledConnection(properties);\r\n  }\r\n\r\n  public String getTcpNoDelay () {\r\n    return this.tcpNoDelay;\r\n  }\r\n\r\n  public void setTcpNoDelay (String value) {\r\n    this.tcpNoDelay = value;\r\n  }\r\n}\r\n<\/pre>\n<p>We compiled this class and put it in a jarfile, placed it in the JBOSS_HOME\/server\/your_server_name\/lib directory, and edited the ds.xml file to reflect our jar and the tcpNoDelay property, shown below&#8230;<\/p>\n<pre lang=\"xml\">\r\n        <xa-datasource>\r\n                <jndi-name>atgcatalogroa_ds<\/jndi-name>\r\n                <xa-datasource-class>com.express.infra.jdbc.oracleXADriver<\/xa-datasource-class>\r\n                <xa-datasource-property name=\"URL\">jdbc:oracle:thin:@\/\/host:port\/service_name<\/xa-datasource-property>\r\n                <xa-datasource-property name=\"tcpNoDelay\">true<\/xa-datasource-property>\r\n\r\n<snip>\r\n\r\n        <\/xa-datasource>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>While troubleshooting performance problems, we wanted to test disabling Nagle&#8217;s algorithm in JBOSS with an Oracle XA datasource. We found that property was not configurable in the regular Oracle XA class. We ended up extending the Oracle class to set&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2013\/08\/06\/setting-tcpnodelay-on-oracle-xa-datasource-in-jboss\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,24,25,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3209"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3209"}],"version-history":[{"count":11,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3209\/revisions"}],"predecessor-version":[{"id":3233,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3209\/revisions\/3233"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3209"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}