Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Does this still hold true?

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    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?

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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.

Similar Threads

  1. Replies: 4
    Last Post: April 27th, 2010, 01:18 AM