[JBoss JIRA] (ISPN-1808) Make InfiniSpan passivation faster
by Johann Burkard (JIRA)
Johann Burkard created ISPN-1808:
------------------------------------
Summary: Make InfiniSpan passivation faster
Key: ISPN-1808
URL: https://issues.jboss.org/browse/ISPN-1808
Project: Infinispan
Issue Type: Enhancement
Components: Loaders and Stores, Marshalling
Affects Versions: 5.1.0.FINAL, 5.1.0.CR4
Reporter: Johann Burkard
Assignee: Galder Zamarreño
While InfiniSpan is very fast in-memory, once passivation is turned on, things get slow for me.
On my i5-2400 with a Crucial C300 SSD, it takes about 11 ms to passivate a 2964 B value. This comes down to a write speed of 250 to 300 KB/s. The disk can write up to 180 MB/s so it's not the bottleneck.
Clearly, passivation should be faster than that.
Profiling with YourKit shows most of the hot spots are centered around {{FileCacheStore}}, the JBoss Marshalling library and various bucket and {{ImmortalCacheEntry}} methods. Locking also seems to play a role. Here's a screenshot:
!http://i.imgur.com/LzkPw.png!
To make profiling easier for you, I've taken my test case and turned it into a small Maven project. Simply running {{mvn install}} should run the test, ready for profiling.
Of course, it could also be that my configuration is suboptimal. However, in my experiments, many configurations were unusable (hitting the file handle limit), which is not a good thing.
The project is available at http://johannburkard.de/resources/Johann/infinispan-performance.zip
I've also found one or two other things I think are more costly than they would need to be
In {{FileCacheStore}}
{code}
byte[] buffer = new byte[streamBufferSize];
...
fileInStream = new FileInputStream(file);
...
bis = new BufferedInputStream(fileInStream);
...
bytesRead = bis.read(buffer, 0, streamBufferSize);
{code}
wrapping the {{FileInputStream}} in a {{BufferedInputStream}} is unnecessary because you already have a buffer in {{byte[] buffer}}. I think I have seen this before in InfiniSpan, so you might want to check for occurrences of {{BufferedInputStream}} or {{BufferedOutputStream}}.
Another one
{code}
if (bytes.length == 0) {
// Short circuit
if (f.exists()) f.delete();
return;
}
{code}
{{f.exists()}} is essentially a syscall. Just calling {{f.delete()}} is enough.
{code}
if (!root.exists()) {
if (!root.mkdirs()) {
log.problemsCreatingDirectory(root);
}
}
if (!root.exists()) {
throw new ConfigurationException("Directory " + root.getAbsolutePath() + " does not exist and cannot be created!");
}
{code}
This could also be shortened to
{code}
if (!root.mkdirs()) {
throw new ConfigurationException("Directory " + root.getAbsolutePath() + " does not exist and cannot be created!");
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (ISPN-1359) SetExternalizer Cannot Properly Handle TreeSets Constructed With Comparator
by Ryan Scharer (JIRA)
SetExternalizer Cannot Properly Handle TreeSets Constructed With Comparator
---------------------------------------------------------------------------
Key: ISPN-1359
URL: https://issues.jboss.org/browse/ISPN-1359
Project: Infinispan
Issue Type: Bug
Components: Marshalling
Affects Versions: 5.0.0.FINAL
Environment: OSX 10.7.1, System JDK
Reporter: Ryan Scharer
Assignee: Manik Surtani
TreeSets can be used to hold objects that don't implement Comparable, so long as you provide a Comparator during construction. The current implementation of SetExternalizer doesn't support this pattern... trying to deserialize a TreeSet that holds objects that don't implement Comparable results in a ClassCastException. This seriously reduces the flexibility of TreeSet.
JBoss Cache doesn't have this limitation, presumably because it delegates to native Java serialization.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (ISPN-604) Re-design CacheStore transactions
by Mircea Markus (JIRA)
Re-design CacheStore transactions
----------------------------------
Key: ISPN-604
URL: https://jira.jboss.org/browse/ISPN-604
Project: Infinispan
Issue Type: Feature Request
Components: Loaders and Stores, Transactions
Affects Versions: 4.1.0.CR2, 4.0.0.Final
Reporter: Mircea Markus
Assignee: Mircea Markus
Fix For: 5.0.0.Final
Current(4.1.x) transaction implementation in CacheStores is brocken in several ways:
1st problem.
- AbstractCacheStore.prepare:
public void prepare(List<? extends Modification> mods, GlobalTransaction tx, boolean isOnePhase) throws CacheLoaderException {
if (isOnePhase) {
applyModifications(mods);
} else {
transactions.put(tx, mods);
}
}
If this is 1PC we apply the modifications in the prepare phase - we should do it in the commit phase (as JTA does it).
2nd problem.
This currently exhibits during commit/rollback with JdbcXyzCacheStore, but it is rather a more general cache store issue.
When using a TransactionManager, during TM.commit AbstractCacheStore.commit is being called internally which tries to apply all the modifications that happened during that transaction.
Within the scope of AbstractCacheStore.commit, JdbcStore obtains a connection from a DataSource and tries to write the modifications on that connection.
Now if the DataSource is managed (e.g. by an A.S.) on the DS.getConnection call the A.S. would try to enlist the connection with the ongoing transaction by calling Transaction.enlistResource(XAResource xaRes) [1]
This method fails with an IllegalStateException, because the transaction's status is preparing (see javax.transaction.Transaction.enlistResource).
Suggested fix:
- the modifications should be registered to the transaction as they happen(vs. during prepare/commit as it happens now)
- this requires API changes in CacheStore, e.g.
void store(InternalCacheEntry entry)
should become
void store(InternalCacheEntry entry, GlobalTransaction gtx)
(gtx would be null if this is not a transactional call).
[1] This behavior is specified by the JDBC 2.0 Standard Extension API, chapter 7 - distributed transaction
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months