I have configured JBoss Cache to asynchronously write to a MySQL database. I'm using
this "write-behind" configuration in order to improve performance by not
blocking the client while writing to the database. However, it seems that there is still a
performance hit. For example, I tested writing an object to the JBoss Cache without any
persistence. This only took about 1ms. In contrast, when I configured the cache to use
MySQL asynchronously, the operation took about 30ms. My cache config file looks like
this:
<?xml version="1.0" encoding="UTF-8"?>
| <jbosscache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:jbosscache-core:config:3.1">
| <loaders passivation="false" shared="true">
| <loader class="org.jboss.cache.loader.JDBCCacheLoader"
async="true"
| fetchPersistentState="false"
ignoreModifications="false" purgeOnStartup="false">
| <properties>
| cache.jdbc.table.name=jbosscache
| cache.jdbc.table.create=true
| cache.jdbc.table.drop=false
| cache.jdbc.table.primarykey=jbosscache_pk
| cache.jdbc.fqn.column=fqn
| cache.jdbc.fqn.type=VARCHAR(255)
| cache.jdbc.node.column=node
| cache.jdbc.parent.column=parent
| cache.jdbc.driver=com.mysql.jdbc.Driver
|
cache.jdbc.url=jdbc:mysql://${interview.db.host:localhost}:${interview.db.port:3306}/${interview.db.name:mydatabase}
| cache.jdbc.user=${interview.db.username:root}
| cache.jdbc.password=${interview.db.password:}
| cache.jdbc.node.type=LONGBLOB
| </properties>
| </loader>
| </loaders>
| </jbosscache>
Why does it take so much longer to write to a cache that asynchronously writes to a
database? Shouldn't this call return immediately while running the database update in
a separate thread? Is it caused by the overhead required to create and run the new
thread?
Thanks!
Dustin
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260196#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...