• Post Reply Bookmark Topic Watch Topic
  • New Topic

filechannel.write is taking long time  RSS feed

 
Anup Katariya
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please see below program. This program takes around 35 milliseconds on 8 core machine when count is 100 or more. But when I comment below line

channel.truncate(0);

then it takes around 2 milliseconds.

I ran this program on different linux machine where OS, JDK is same. I found that it is working fine on some machine and its worst on some machines. I compared various operating system parameters but didnt find any issue. On machines where it is working fine, I found that there is only one hard drive mounted.

Anybody knows any configuration which can cause such issues?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your program it looks like that your application is I/O intensive application. So, in most of the cases the performance of your code will be governed by how fast are your disk operations which is directly proportional to the kind of disk you are using.

How big is the file that you use?
channel.truncate() looks to be the method with the greates I/O cost since by commenting it your response time dips alot. It will be so if the file size is huge and it spans around multiple sectors on the disk.

Try optimizing your disk and you may get better performance even with a smaller capacity machine.
 
Anup Katariya
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying.

We figured it out that it was channel.force() method taking the time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!