Solved Using multiple file streams

Discussion in 'Plugin Development' started by Wizardo367, Mar 2, 2014.

Thread Status:
Not open for further replies.
  1. Hello people! As you can probably guess by the title I have a question about using multiple file streams. Currently I'm adjusting my plugin to use cached data from a database and all MySQL functionality will be ran on a separate async thread to prevent lag.

    However the data stored in the cache is also very important and since the data pretty much splits in category's I'm going be using three different text files to store it. So what I'd like to know is whether or not running these streams on the main thread will cause lag on huge servers and if it will cause lag then should I run them on a sync or async thread?

    P.S Remember I'm trying to minimise data loss in the event of a sudden shutdown.
     
  2. Offline

    xTrollxDudex

    Wizardo367
    Threads are all stopped in a shutdown. Use a heap analyzer like visualvm to view current memory usage by the server and specific elements. If it is using a large percentage of memory, it probably will lag on a large scale server.
     
  3. Basically these files will be constantly read and written to whilst the plugin is running so that if the server does suddenly shutdown then the worst that could happen is one record gets lost, the files are then used to update the database once the plugin starts again. I just need to know if doing this will cause lag since these records are one line long and may occur every second or less on insanely large servers servers.

    P.S Thanks for the tips in your post. :D
     
  4. Offline

    xTrollxDudex

    Wizardo367
    Constant IO whether or not on a separate thread will cause some performance issues. Synchronization also is very slow.
     
  5. Hmm OK then, I'll try to find some way of using a single stream which shouldn't be too hard if I use different delimiters for each type of data. If that still causes performance issues then I'll have to update the database more often :(.

    Thanks for all of your help on this I really appreciate it. :D
     
Thread Status:
Not open for further replies.

Share This Page