Hi all,
I encountered a problem during the commit of XADisk.
Following you find a wrap up of the problem.
Any help is much appreciated!
Initial situation
I want to store 100.000 DB entries in the file-system of my server running jBoss EAP 6.0
For this, I'm using a job who is triggered every day once.
To be able to rollback after an error, I'm using an transaction during writing to the filesystem and setting the "already saved"-flag in the DB.
If one part of this job fails, everything should be rolled back.
XADisk helps me to write transactional to the file-system and works in two steps:
- create 1000 files with 100 DB entries (file size is about 100kb each)
- commit the files and writing them effectively to the file-system
public void writeByteArrayToFile(String filename, byte[] fileToWrite) {
StandaloneFileSystemConfiguration config = createConfiguration("/sysDir/");
config.setTransactionTimeout(300); // 5 Minutes
XAFileSystem fileSystem = XAFileSystemProxy.getNativeXAFileSystemReference("xaDiskInstance");
fileSystem.waitForBootup(WAIT_FOR_BOOTUP_TIME);
session = fileSystem.createSessionForLocalTransaction();
File file = new File(filename);
session.createFile(file, false); // false to create file, true for directory
XAFileOutputStream xafos = session.createXAFileOutputStream(file, true);
xafos.write(fileToWrite);
LOGGER.info("Successfully written " + fileToWrite.length + " Bytes to " + file.getAbsolutePath());
LOGGER.info("Start XADisk committing");
LOGGER.info("XADisk commit successful.");
} catch (NoTransactionAssociatedException e) {
Problem
The second step - the commit - takes extremely long on some environments (see analysis).
The same software release is running on all environments and the file size is always almost the same (per file about 100kb)
Analysis
The commit was tested on 4 environments:
- localhost (Windows)
- MGT (test server) (Linux)
- Technical Test (Linux)
- Development server (Linux)
Following times are measured (localhost isn't in the list due to windows):
MGT |
=
101,241 seconds for the XADisk commit |
33,747 |
ms per file |
|
2015-04-17
10:52:16,474|INFO|XADiskUtil||Start XADisk committing |
0,56 |
minutes
per 100.000 |
2015-04-17
10:53:57,715|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-04-17
10:53:57,715|INFO|EticketDdsEntsorgungServiceBean||Copied 300010 database
entries |
|
|
|
|
|
|
|
|
|
MGT |
= 25,0448 seconds for the
XADisk commit |
8,34933333 |
ms per file |
|
2015-04-17
12:27:11,035|INFO|XADiskUtil||Start XADisk committing |
0,14 |
minutes
per 100.000 |
2015-04-17
12:27:36,083|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-04-17
12:27:36,083|INFO|EticketDdsEntsorgungServiceBean||Copied 300010 database
entries |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dev server |
= 1873,490 seconds for
the XADisk commit |
4683,725 |
ms per file |
|
2015-04-17
00:00:47,965|INFO|XADiskUtil||Start XADisk committing |
78,06 |
minutes
per 100.000 |
2015-04-17
00:32:01,455|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-04-17
00:32:01,456|INFO|EticketDdsEntsorgungServiceBean||Copied 40000 database
entries |
|
|
|
|
|
|
|
|
|
dev server |
= 1913,239 seconds for
the XADisk commit |
4783,0975 |
ms per file |
|
2015-04-17
16:08:07,181|INFO|XADiskUtil||Start XADisk committing |
79,72 |
minutes
per 100.000 |
2015-04-17
16:40:00,420|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-04-17
16:40:00,421|INFO|EticketDdsEntsorgungServiceBean||Copied 40000 database
entries |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
technical test |
= 5073,385 seconds for
the XADisk commit |
3618,67689 |
ms per file |
|
2015-03-26
16:32:48,595|INFO|XADiskUtil||Start XADisk committing |
60,31 |
minutes
per 100.000 |
2015-03-26
17:57:21,980|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-03-26
17:57:21,980|INFO|EticketDdsEntsorgungServiceBean||Copied 140216 database
entries |
|
|
|
|
|
|
|
|
|
technical test |
= 5878,897 seconds for
the XADisk commit |
3446,01231 |
ms per file |
|
2015-04-14
17:50:09,003|INFO|XADiskUtil||Start XADisk committing |
57,43 |
minutes
per 100.000 |
2015-04-14
19:28:07,900|INFO|XADiskUtil||XADisk commit successful. |
|
database
entries |
2015-04-14
19:28:07,901|INFO|EticketDdsEntsorgungServiceBean||Copied 170583 database
entries |
|
Summary
Committing the files on the dev server and the technical test is about 196 times slower than on the MGT.
Does anyone have an idea why this is so slow?
Greetings,
Kevin