User: Password:
|
|
Subscribe / Log in / New account

Problems

Problems

Posted Dec 4, 2003 3:47 UTC (Thu) by ncm (subscriber, #165)
Parent article: Peer to Peer Freedom of Speech

My problem with Freenet is not distaste for some of the content, or for illegalities. It's more basic. Every time I have tried to run it, it has either got stuck in an infinite loop (using all available CPU cycles, an event I notice when my laptop fan comes on!) or consumed increasing amounts of memory until my machine began thrashing the disk (also audible!).

I blame these problems not on poor coding, but rather on a poor choice of implementation language. Java may be suitable for programs that run to completion in a short time and under controlled conditions, but it does not seem to be a good choice for long-running programs run under widely varying circumstances. If Freenet were to run under xinetd, and die frequently and be restarted whenever there was work to do, it might be tolerable for it to be in Java. As it is, I can't use it.


(Log in to post comments)

Problems

Posted Dec 4, 2003 15:11 UTC (Thu) by zlynx (subscriber, #2285) [Link]

Not everyone has those problems. For me, Freenet runs fine, using about 380 MB of RAM while running. It's run fine for weeks at a time.

A couple of suggestions: Use the newest Sun JRE, and run Freenet with "-Xmx512M" on the Java command line. Part of your problem with the high CPU usage might be Java trying to find available memory to garbage collect, so just give Java more space.

Problems

Posted Dec 4, 2003 16:55 UTC (Thu) by ncm (subscriber, #165) [Link]

My machine doesn't have 380M of RAM. Few do. It's frankly obscene that a program that just moves data from disk to network and back, with tiny indexing needs, consumes not just megabytes, but hundreds of megabytes.

Again, I'm inclined to blame Java and its faulty memory management model, as embodied in equally faulty JVMs. There are good reasons that hardly any Free Software projects are written in Java. (I don't count those meant for people who are obliged to run Java anyhow.)

Problems

Posted Dec 4, 2003 18:50 UTC (Thu) by stuart2048 (guest, #6241) [Link]

I think you have it backwards. Long running, dynamic programs are an ideal candidate for Java. Good security and gc. Short lived programs, like cat or ls are bad candidates because the JVM startup and teardown cost is huge. Kind of like stuffing an elephant through a garden hose.

This heavyweight startup is one of the most frustrating things I find with Sun's JVM implementations. (Note that I am careful to separate the JVM implementation from Java-the-language.) Moore's law is doing a better job than Sun at making Java start faster, unfortunately.

I have made a career out of building long lived Java programs. And I too would say that 380MB is on the unreasonably high side. However the good news about Java is that it's possible to inspect the code and heap to see exactly where all that CPU and memory is going. You can do extremely detailed analysis of program flow and discover every object's lifetime, transparently without any developer involvement. This is very powerful. (Have you read Permutation City? Java might be a good candidate for running copies and the Autoverse :-).

Unfortunately, bloat is often not your fault at all: sometimes it's the underlying library. Library developers with big, fat 3.0GHz machines often don't see the cost of their laziness ;-).

Writing good, well behaved Java programs takes a great deal of experience in knowing what works and what doesn't. Java makes it easy to write slow code that works. With a little more effort it is also possible to write efficient code that works better.

--Stuart


Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds