Benchmark
Hello all! Where can I find a widely used benchmark program? There are currently quite many JVM:s available for Linux, and it would be nice to be able to compare them. /Per Widerlund
Re: Java Web Server
Michael D. James wrote: > I think I've heard discussion on this topic but I didn't pay attention > because I didn't realize I would need to know. > > Is anyone successfully running Java Web Server on Linux? > http://jserv.java.sun.com/products/webserver/features/index.html#cross > makes a big deal about it being supported across many platforms but > the system requirements don't list Linux as one of the supported > operating systems. The Solaris version can be ported to Linux without any problems. There's a patch available somewhere at Blackdown if I remember correctly (anyway - it's just a few minor changes). > If not, does anyone recommend another web server supporting SSL on > Linux (such as Stronghold or Raven)? Try Roxen Challenger, at http://www.idonex.se. /Per Widerlund
Re: Need a Java/Linux RedHat 5.0 configuration where getLocalHost works
John A. Zinky wrote:
> We have not been able to find a configuration of Linux Red Hat 5.0 and
> jdk 1.1.x that works for the following one line test program.
>
> public class TestGetLocalHost {
> public static void main(String[] args) {
> try {
> System.out.println(java.net.InetAddress.getLocalHost());
> } catch (Exception e) { e.printStackTrace(); }
> }}
>
> The Test program prints the IP address of local host
> (A necessary function for servers that need to publish their location)
>
> On Solaris,NT, and Red Hat 4.0/jdk1.1.3 this works: e.g:
>guava.bbn.com/171.78.82.34
> On Linux Red Hat 5.0 jdk1.1.5 this returns the loopback address: e.g:
>localhost/127.0.0.1
>
> We have traced the problem in to the C routines for native platform
> on Line 298 in .../jdk1.1.5/src/java/net/InetAddress.java
> localHost.hostName = impl.getLocalHostName();
> System.out.println("local host name: " + localHost.hostName);
>
> On linux: local host name: localhost
> On Solaris: local host name: guava.bbn.com
>
> Questions *
> 1) Does anyone have a Linux RedHat 5.0 configuration where this program works?
It works fine for me: RedHat 5.0 and jdk1.1.6-v1 (sbb). Make sure you
have the
latest version of libc installed (can be found at www.redhat.com).
> [ ]
> 2) Could this be a configuration error in the linux host?
I believe that is the case. Try with DNS configured.
> [ ]
/Per Widerlund
Re: Need a Java/Linux RedHat 5.0 configuration where getLocalHost works
[EMAIL PROTECTED] wrote: > I'll bet that the first line in your /etc/hosts is: > > 127.0.0.1 localhost localhost.localdomain > > At least, that's the way it was with mine and, when I tried your program, I > got the same "broken" answer you got. After reading Per's message, I moved > that line below the second line in my /etc/hosts so that it looks like this: > > 198.41.2.245knight.internic.net knight > 127.0.0.1 localhost localhost.localdomain > > Guess what? It now works correctly. I have a feeling that it shouldn't be > dependent on your /etc/hosts entry order, but at least this will account for > the difference between your and Per's results. > > BTW, I'm testing this on a RH 5.1 system with sn's jdk-1.1.6v1.2. My (that is me Per) /etc/hosts file has localhost as the first line, but I have DNS configured and I think that is what made the difference for me. I vaguely remember having a similar problem with the 'hostname' command - it kept resulting in "localhost" until I changed my hosts file.. Anyway, the problem is most likely not Java related. /Per Widerlund
Regexp utility classes..
Hello List.. This may not be the appropriate mailing list to ask about this, but does anyone know of some good classes for handling regular expressions? /Per Widerlund
Re: can't find libjava.so
Steve Cohen wrote: > I have installed jdk 1.2 on my redhat 5.2 system and pointed my path at > it. When I try to run java, I get the Error can't find libjava.so. > I can find this file in jdk1.2/jre/lib/i386. I tried copying it to > /lib. That didnt' work. Where is it expecting to find this file? I believe the script is written in such a way that you have to have it in your path. Going to the directory and executing "./java" gives the result you describe, but executing "java" when it can be found in the path works fine. Regards, Per Widerlund -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Socket connect timeout?
Hello all.. Consider the following scenario: You want to connect to a remote server that may or may not be up and running (or even reachable). You want to be able to specify the exact amount of time before the connection attempt times out. You are not allowed to use any of the soon-to-be- deprecated (JDK1.2) methods in the Thread class. Solution? /Per Widerlund
Re: Socket connect timeout?
A. Craig West wrote: > This thread isn't exactly topical to Java-Linux, but I'll throw in my 2 > bits to bring > it some closure, I hope. I apologize for posting a non-Java-Linux topic, but I have asked this question to all places I know that there are experienced Java programmers. > It is true that Socket.setSoTimeout(int timeout) causes reads to throw an > InterruptedIOException, but the problem he is trying to solve is that it > does NOT cause connects to throw an exception, or timeout in any other way. > It will timeout eventually, depending on the OS, but there is no control > over it. > When I need to do this, I use another thread to check the timeout, and > if it has expired, I close the Socket. That tends to work to unblock the > thread doing the connect. How do you close the socket? The only way to connect is using the socket constructor.. ..so how can you have a reference to invoke close() on before the actual constructor is finished. > Actually, there is an On-Topic question for you... Does closing the > Socket on the Linux JDK port cause the connect statement to throw an > Exception of some kind? > I've never tried it in Linux... I fail to see how you can have tried it at all (see above). > > Juergen Sonnauer wrote: > > > > What about Socket.setSoTimeout(int timeout)? Should throw a > > InterruptedIOException after specified milliseconds on read method. > > /Per Widerlund
Thread pooling..
Hello all! After reading and hearing about the performance that can be gained by using thread pools, I made a simple thread pool implementation. On my Linux machine (PII266/64) running jdk1.1.6-v2 (sbb), I got a 0.15 ms/thread reduction in thread start-up overhead. (The test was iterated 6 times.) Is a 0.15 ms reduction really worth the effort? A server would have to have a very large amount of hits/second before 0.15 ms makes any difference. Has anyone else experimented with pools? Are there any good articles on the subject available somewhere? /Per Widerlund
Re: Thread pooling..
Michael Sinz wrote: > > On Mon, 31 Aug 1998 14:14:21 +0000, Per Widerlund wrote: > > > >After reading and hearing about the performance that can > >be gained by using thread pools, I made a simple thread > >pool implementation. > > > >On my Linux machine (PII266/64) running jdk1.1.6-v2 (sbb), > >I got a 0.15 ms/thread reduction in thread start-up overhead. > >(The test was iterated 6 times.) > > I have been doing thread pooling for about as long as I have > been doing Java. The main reason I started (and wrote my own > "thread" class that does the pooling automatically) is so that > the code I had would work. Some of the earlier JDKs had a problem > with leaking memory for each thread created. (Even after all of the > gc() and finalization tricks possible were tried.) This bug has > been fixed in the Sun JDK but some other JVMs do not yet have > this fixed. > > >Is a 0.15 ms reduction really worth the effort? A server would > >have to have a very large amount of hits/second before > >0.15 ms makes any difference. > > Depends on how you look at it. Most web servers would love to get > that reduction on disk performance. Most web servers are *not* CPU > limited but I/O limited. Yes, the number of threads started can not be compared to disk access. In my experience, the servers can indeed be CPU limited when Java is involved though. > Now, however, that 0.15ms is on a Linux system running the current > and reasonably fixed JDK> It is running "greenthreads" which means > that the threads are *very* light weight and implemented at the > JVM. On systems with native threads, the thread overhead may well > be much higher. On my Windows95 box (something no sane person would > use as a server) the thread overhead is such that I saved over 7ms > in thread startup time by using an already existing thread from the > pool. That is a rather large number. On NT, that number was down to > 4.5 ms (but the standard deviation was *much* higher, meaning rather > wide ranging results.) I just tried my test program using the native threads implementation on Linux available from OpenGroup. The result is indeed in favor of pooling - the gain is now around 0.6 ms. Still, this is not enough to convince me. (The results on Windows machines are of no interest to me since I consider myself sane.) It would be interesting to hear some overhead figures on Solaris or some other server OS with native thread support. /Per Widerlund
[OT] Proposal: select(readfds, writefds, exceptfds)
This is a general Java proposal, but here it is anyway: Handling I/O on several file descriptors can not be done efficiently without using multiple threads. Why not add a method to reach the select function of the underlying OS? Add a new class java.io.FileDescriptorSet with methods like: void set(FileDescriptor fd) throws IOException void clear(FileDescriptor fd) throws IOException boolean isSet(FileDescriptor fd) throws IOException void zero() throws IOException The select method could be added to java.lang.System or to some apropriate class in java.io: static int select(FileDescriptorSet readfds, FileDescriptorSet writefds, FileDescriptorSet exceptfds) throws IOException Can this be done, and if so: why has it not been done already? Comments please.. //Per Widerlund -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Re: [OT] Proposal: select ..
Michael Sinz wrote: MS> Why? Java is platform independant and many (most) non-UNIX MS> platforms use other mechansims and, if they have a POSIX MS> layer, they emulate it only. If that is the case, then there is nothing to do - Java must remain platform independent. I thought that something similar to select was available in all OS:es. MS> Second, Java has threads built in. Why not use them? MS> One of the really nice parts of Java is that it has some MS> of these concepts, such as threads and synchronization MS> built in. This is part of the language specification. MS> One should use those mechanisms. A thread uses lots of resources. I am not sure I buy your argument: threads are part of the specification and therefore we cannot change the specification.. MS> You may find out that it ends up being easier since you MS> write your code to deal with one file and that one file MS> only and just get multiple objects or different classes MS> together to handle the whole combination. Yes, it is indeed a simple and elegant way to handle things, but you waste a lot of precious resources. When you want to handle hundreds of socket connections and must start up two threads per connection you soon run into trouble. //Per Widerlund -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: select() API
Bernhard Fastenrath wrote: > > [EMAIL PROTECTED] wrote: > > At least one company I know of has been forced to a custom JVM > > (Hewlett-Packard's) in order to get acceptable performance out of a > > Java-based server, and they basically made an interface to select(). > > I believe they've submitted a proposal to Sun also. And according to > > them, the Sun engineers are amenable to doing something about this. > > Oops, i was just about to implement it myself. > Is their select() interface availabe online? I just finished implementing a FileDescriptorSet class, but it requires some further testing to verify that it is thread safe. According to the description in the iomgr.c file in the jdk1.1 source it should be safe to call the select() function found in that file. Does anyone know if some special care must be taken before calling that function? //Per Widerlund -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: NoClassDefFoundError... argh!
> My app has recently started throwing NoClassDefFoundErrors. It started
> after I made some fairly large code changes, but the errors are coming
> from code that was unchanged...
>
> I've removed all the class files and recompiled (hooray for Makefiles!),
> with the same result. The only other things in my classpath are rt.jar
> and the gnu regular expression package's jar. This should mean that
> version skew isn't the cause.
>
> I tried putting try{}catch(Throwable t){t.printStackTrace();} around the
> constructors of the classes in question, so I know pretty exactly where
> it's happening, but not why.
>
> I just tried recompiling everything with javac (I was using jikes), no
> change.
>
> The freaky thing here is that these errors don't get thrown every time.
> This error gets thrown in the init phase of the app's life (reading its
> config files). Sometimes it dies, sometimes it lives, even given the
> exact some config file.
>
> By the way, the class file in question does exist and is in my classpath.
> javap finds it just fine. The class contains no static block and no
> static variables.
>
> I can (try to) provide any other relevant info.
>
> Am I going crazy?
You can get NoClassDefFoundError for a class which extends another class
that was somehow unable to load. This can be a bit tricky to locate.
Just a thought.
//Per Widerlund
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
