English 中文(简体)
I/O 多国公司的业绩 (Windows 7 受到影响,LCH工程)
原标题:I/O performance of multiple JVM (Windows 7 affected, Linux works)

我有一个方案,编制大约50名德国马克的档案。 在这一过程期间,该方案经常重写档案的章节,并迫使对磁盘的改动(按100次顺序排列)。 它使用传道和直接贝特德(......)、fc.write(......)和fc.force(......)。

www.un.org/Depts/DGACM/index_spanish.htm 新案文:

I have a better view on the problem now. The problem appears to be that I use three different JVMs to modify a file (one creates it, two others (launched from the first) write to it). Every JVM closes the file properly before the next JVM is started. The problem is that the cost of fc.write() to that file occasionally goes through the roof for the third JVM (in the order of 100 times the normal cost). That is, all write operations are equally slow, it is not just one that hang very long. Interestingly, one way to help this is to insert delays (2 seconds) between the launching of JVMs. Without delay, writing is always slow, with delay, the writing is slow aboutr every second time or so.

I also found this Stackoverflow: How to unmap a file from memory mapped using FileChannel in java? which describes a problem for mapped files, which I m not using.

What I suspect might be going on: Java does not completely release the file handle when I call close(). When the next JVM is started, Java (or Windows) recognizes concurrent access to that file and installes some expensive concurrency handler for that file, which makes writing expensive. Would that make sense?

问题出现在Windows 7上(Java 6和7,用两台机器测试),但并不在Ltlin下(SuSE 11.364)。

www.un.org/Depts/DGACM/index_spanish.htm 旧案文:

The problem: Starting the program from as a JUnit test harness from eclipse or from console works fine, it takes around 3 seconds. Starting the program through an ant task (or through JUnit by kicking of a separate JVM using a ProcessBuilder) slows the program down to 70-80 seconds for the same task (factor 20-30).

Using -Xprof reveals that the usage of force0 and pwrite goes through the roof from 34.1% (76+20 tics) to 97.3% (3587+2913+751 tics): Fast run:

27.0%     0  +    76    sun.nio.ch.FileChannelImpl.force0
 7.1%     0  +    20    sun.nio.ch.FileDispatcher.pwrite0
[..]

Slow run:

    Interpreted + native   Method                        
48.1%     0  +  3587    sun.nio.ch.FileDispatcher.pwrite0
39.1%     0  +  2913    sun.nio.ch.FileChannelImpl.force0
[..]
     Stub + native   Method                        
10.1%     0  +   751    sun.nio.ch.FileDispatcher.pwrite0
[..]

GC和汇编可忽略不计。

More facts:

没有任何其他方法显示,----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • It s either fast or very slow, never something in-between.
  • Memory is not a problem, all test machines have at least 8GB, the process uses <200MB
  • rebooting the machine does not help
  • switching of virus-scanners and similar stuff has no affect
  • When the process is slow, there is virtually no CPU usage
  • It is never slow when running it from a normal JVM
  • It is pretty consistently slow when running it in a JVM that was started from the first JVM (via ProcessBuilder or as ant-task)
  • All JVMs are exactly the same. I output System.getProperty("java.home") and the JVM options via RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean(); List arguments = RuntimemxBean.getInputArguments();
  • I tested it on two machines with Windows7 64bit, Java 7u2, Java 6u26 and JRockit, the hardware of the machines differs, though, but the results are very similar.
  • I tested it also from outside Eclipse (command-line ant) but no difference there.
  • The whole program is written by myself, all it does is reading and writing to/from this file, no other libraries are used, especially no native libraries. -

我只是拒绝相信有任何意义的一些 facts的事实:

  • Removing all class files and rebuilding the project sometimes (rarely) helps. The program (nested version) runs fast one or two times before becoming extremely slow again.
  • Installing a new JVM always helps (every single time!) such that the (nested) program runs fast at least once! Installing a JDK counts as two because both the JDK-jre and the JRE-jre work fine at least once. Overinstalling a JVM does not help. Neither does rebooting. I haven t tried deleting/rebooting/reinstalling yet ...
  • These are the only two ways I ever managed to get fast program runtimes for the nested program.

问题:

  • What may cause this performance drop for nested JVMs?
  • What exactly do these methods do (pwrite0/force0)? -
问题回答

您是否使用当地磁盘进行所有测试(相对于任何网络份额而言)?

您的人选 存储数据的视窗? 如果联合选举程序终止,其档案处理就会关闭,但你可能看到的是将数据输入磁盘。 当你夸大数据时,原数据版本被弃置,可能不会造成磁盘。 关闭档案的行为可能使窗户暗中抽取数据。 因此,如果使用斜体,你就可以确认,由于磁盘的IO时间已从贵方位中删除。

找到一个窗户工具,使你能够迫使板子把所有的缓冲器 disk到软盘中,在证书操作之间使用这一工具,看看当时需要多长时间。

但我要猜测,你在试图管理软磁盘缓冲藏匿点时,对这一进程的要求和掩体的要求置若.闻。 在气温中,有“白化沙”等工具。

FWIW

“pwrite”是一份让档案记录员同时撰写的文件(这是供联合记录员使用的最佳掩体扫描器),因此,我认为Win32 PIC已经规定,同样的使用方式可以在一个过程的路口之间分享档案,但由于Sun有独一无二的遗传物在“团结”之后被点名。 页: 1

“力量”我会猜测,这是一个档案系统辛迪加,意思是,这一过程要求ker子将不成文的数据(目前存放在软盘中)输入磁盘上的文件(如在你把计算机关闭之前需要)。 这一行动将随着时间的推移而自动发生,但交易系统需要知道以前书写的数据(带有标准)何时实际击中了实物盘并储存。 由于其他一些磁盘,IO取决于是否知道,例如交易检查站。

有助于确保你明确制定null。 然后打电话System.runFinalization()和beSystem.gc( at the end of the program. 你可能需要超过1次电话。

System.runFinalizersOnExit(true) may also help, but it s deprecated so you will have to deal with the compiler warnings.





相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

热门标签