Archive

Archive for February, 2016

Timeouts for Oracle XA datasources in JBoss EAP 6

The documentation for configuring datasources in JBoss EAP 6 is somewhat lacking when it comes to timeouts. Normally this is fine, but what if there are network issues? With the wrong timeout settings the application can hang until it is killed and restarted. With proper timeouts it can handle an outage and recover.

Here is an example:


<xa-datasource jndi-name="java:/AppDS" pool-name="AppDS">
  <xa-datasource-property name="URL">
    ${appdb.url}
  </xa-datasource-property>
  <xa-datasource-property name="nativeXA">true</xa-datasource-property>
  <xa-datasource-property name="ConnectionProperties">
    oracle.jdbc.ReadTimeout=330000
  </xa-datasource-property>
  <xa-datasource-class>
    oracle.jdbc.xa.client.OracleXADataSource
  </xa-datasource-class>
  <driver>oracle</driver>
  <security>
    <user-name>${appdb.user}</user-name>
    <password>${appdb.password}</password>
  </security>
  <xa-pool>
    <min-pool-size>${appdb.min.pool.size}</min-pool-size>
    <max-pool-size>${appdb.max.pool.size}</max-pool-size>
    <prefill>false</prefill>
    <use-strict-min>false</use-strict-min>
    <flush-strategy>FailingConnectionOnly</flush-strategy>
    <is-same-rm-override>false</is-same-rm-override>
    <no-tx-separate-pools/>
    <pad-xid>true</pad-xid>
    <wrap-xa-resource>true</wrap-xa-resource>
  </xa-pool>
  <validation>
    <valid-connection-checker class-name=
      "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
    <stale-connection-checker class-name=
      "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
    <exception-sorter class-name=
      "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
  </validation>
  <timeout>
    <blocking-timeout-millis>60000</blocking-timeout-millis>
    <xa-resource-timeout>310</xa-resource-timeout>
    <query-timeout>300</query-timeout>
    <set-tx-query-timeout/>
  </timeout>
  <statement>
    <track-statements>false</track-statements>
  </statement>
  <recovery no-recovery="false">
    <recover-credential>
      <user-name>${appdb.user}</user-name>
      <password>${appdb.password}</password>
    </recover-credential>
  </recovery>
</xa-datasource>

The oracle.jdbc.ReadTimeout is essential. It sets the network timeout on the socket, making reads time out eventually in the face of a broken connection. The default TCP timeout for established connections is very long, so it is important to set a value. It should be larger than the transaction timeouts. The query timeout and tx-query-timeout both limit the time that individual statements can take. The query timeout is used when there is no transaction, otherwise the remaining time until transaction timeout is used.

Note that read timeout is in milliseconds, query timeout is in seconds.

Advertisements
Categories: Java, Networking, Oracle

Compression ratio and time for common tools

One application I’m working with produces horrendous amounts of log files. They are so large that the process of compressing them and moving them to another server actually has a performance impact on the system in spite of nice and ionice. I decided to compare the most common compression tools. At home I’m using bzip2, as I want the best possible compression ratio. Would that be a good idea?

Compression ratio and time

As the table shows bzip2 is frightfully expensive, but it does produce small files. In addition it makes a big difference if gzip is told to optimize for speed (1) or compression (9), or if it runs at the default level (6). Compress is basically an outdated tool and was included as it is sometimes quoted as being faster than gzip. Here that was not the case.

Categories: Linux

Disable bloatware on Xperia Z5 compact

I recently bought a new phone, the Xperia Z5 compact. It has its strengths and weaknesses. In particular, why do vendors insist on crippling their devices with irritating bloatware?

The Xperia comes with Movie Creator, an app that runs in the background to create meaningless movies from photos. It is about as irritating as Microsoft’s old Clippy. Fortunately it is possible to get rid of the app, even though it can’t be uninstalled. Go to Settings, Apps, All and select Movie Creator. Delete any data it has amassed and then click on disable. That prevents the app from starting. It also removes the icon.

The same procedure should work for other unwanted bundled apps.

Categories: Android