Reading byte data from BLOB vs File System [message #621421] |
Wed, 13 August 2014 04:26 |
|
mafoe
Messages: 6 Registered: July 2014
|
Junior Member |
|
|
I have the requirement to store raw data (ranging in size from 100 kb to 150 MB per file) and read it quickly when needed (in a Java application deployed on a Tomcat, with an Oracle 11g as backend).
Currently we store those files on an NFS. We thought about putting them into our database to reduce maintenance and have a central storage instead of two. My test reading a 13 MB file from NFS versus reading it from a BLOB however were sobering.
From BLOB: 2-3s
From file system: 200ms
Looking at this massive difference, the file system clearly wins.
Is there anything I am missing here? Any kind of obvious performance boost that I missed?
Here's the trivial DDL for the test table:
CREATE TABLE TEST
(
ID NUMBER
, NET BLOB
);
|
|
|
|
Re: Reading byte data from BLOB vs File System [message #621436 is a reply to message #621433] |
Wed, 13 August 2014 05:54 |
|
mafoe
Messages: 6 Registered: July 2014
|
Junior Member |
|
|
Michel Cadot wrote on Wed, 13 August 2014 12:41
How do you read the file from NFS? Post code.
How do you read the BLOB from database? Post code and used tool.
BLOB via JPA:
EntityManager em = emf.createEntityManager();
Query nativeQuery = em.createNativeQuery("SELECT NET FROM TEST");
Blob result = (Blob) nativeQuery.getSingleResult();
byte[] bytes = result.getBytes(1, (int) result.length());
NFS:
Can't post code, but it's basic FileReader/BufferedReader java mechanism.
[Updated on: Wed, 13 August 2014 05:55] Report message to a moderator
|
|
|
|
|
|