Go Back   Java Programming Forums > Java Standard Edition Programming Help > File I/O & Other I/O Streams


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 29-01-2010, 11:31 PM
Junior Member
 

Join Date: Jan 2010
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
April is on a distinguished road
Default Does this still hold true?

Hi everyone,

Back in the "old" days, people always told me, manipulate files as little as possible! It is expensive and will slow down the application! Is this still true?

One of the things I'm working on right now involves a lot of saving, but I have a choice between saving to disk, or saving to a database (which, if you ask me, eventually will end up being saved to disk anyways). Am I right to assume that the "cost" to use either method is more or less the same, with the database incurring a bit more overhead because it needs to figure out where to write the data?

Or am I just archaic in thinking that this is still an issue?

Thanks,
April



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 30-01-2010, 04:38 AM
helloworld922's Avatar
Super Moderator
 

Join Date: Jun 2009
Posts: 1,215
Thanks: 5
Thanked 258 Times in 234 Posts
helloworld922 will become famous soon enoughhelloworld922 will become famous soon enoughhelloworld922 will become famous soon enough
Default Re: Does this still hold true?

It is true that writing/reading from the hard drive is much slower than writing/reading from memory or cache (even with the new solid state hard-disks). However, unless you are dealing with a large amount of data, or are sending reading/writing commands a huge number of times in a short period of time, modern computers are fast enough they can usually handle the read/writes without too much lag.

I know in Java that you can speed up file write times by using a BufferedWriter to encapsulate the FileWriter. In this way, Java is making a bunch of writes to memory, and then every now and then writes chunks of data consecutively (I think when the buffer gets flushed), instead of FileWriter's method of writing to the hard disk every time a write command is given.

What kind of file manipulation did you have in mind?
__________________
ASCII a question .. Get an ANSI

Please surround your code with [highlight=Java]code goes here[/highlight].
Reply With Quote
  #3 (permalink)  
Old 02-02-2010, 01:28 PM
Junior Member
 

Join Date: Jan 2010
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
April is on a distinguished road
Default Re: Does this still hold true?

I guess in essence, I'm trying to log a transaction system. They don't have to be 100% real time accurate (ie. if two people request for a resource at the same time, it's not important down to the milisecond which one was first), but keeping a log of these transactions in sequence is important. I'm expecting maybe 5000-10000 lines per user per four to five hour session, and maybe up to 20-50 concurrent users. I haven't decided whether to keep them separate for each user or have a separate file for each user, but there'll need to be daily archives, etc.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stop or kill a running thread when a condition is true chikaman Threads 4 27-04-2010 06:18 AM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:59 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.