Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JVM monitoring, server-status monitoring, crackers  (Read 2176 times)
0 Members and 1 Guest are viewing this topic.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Posted 2003-07-07 14:36:26 »

A java game-server I'm deploying got attacked over the weekend by a script-kiddie (you can tell because the logfiles show attempts to cause buffer-overflows AND INVOKE CMD.EXE! On a server that is openly unix-based (if they'd bothered to look Wink) and runs a Java server). Anyway, once I'd finished laughing at them...

The server didn't crash, and still accepts incoming connections, but for some reason one of the Selector's that processes requests has just stopped functioning entirely. It could be that the garbage the skiddie was throwing at it (all sorts of rubbish characters) has upset the 1.4.1 Selector; I have no idea. However, I now want to add some JVM-monitoring tools to the server (it already has an interactive admin console) to do things like check "Are all the Selector's OK? Are any of the incoming-queue's unnaturally full (suggesting "hung" connections etc)? What's the memory usage like at the moment?".

Some of these (especially the simple stuff, like current free memory) must have been very useful to many developers for many years, but I cannot seem to find ANY java tools on the net that can be integrated into a compiled app (e.g. as a library) that can spew useful status-info. The nearest I could come up with is profilers and debuggers - neither of which is appropriate, because this is a production server where I do NOT need this stuff running 24/7, I just need to do an occasional "give me a snapshot of the status now, please" - even if that means server slowdown for seconds/minutes/etc.

Some of it is trivial to implement (e.g. getting at memory info from the Runtime class), but other things (like the status of a given Selector) are not so trivial. If I have to, I'll implement my own framework whereby every module supplies String[]'s of it's own status on demand - but surely this is reinventing the wheel?

malloc will be first against the wall when the revolution comes...
Offline leknor

Junior Member




ROCK!!!


« Reply #1 - Posted 2003-07-07 16:51:02 »

Java Management Extensions (JMX) is designed for this type of stuff. I have yet to make time to learn it but I want to.

If you can use BEA's JRrockit JVM (they have win32 and linux versions, maybe more) it has a built in management console which I have not used either.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #2 - Posted 2003-07-07 18:31:14 »

Quote
Java Management Extensions (JMX) is designed for this type of stuff. I have yet to make time to learn it but I want to.



Thanks, that's what I was looking for. Unfortunately it's pretty complex by the looks of things, so this is going to take a loooong time to get through...

malloc will be first against the wall when the revolution comes...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #3 - Posted 2003-10-03 12:44:11 »

Quote
However, I now want to add some JVM-monitoring tools to the server (it already has an interactive admin console) to do things like check "Are all the Selector's OK? Are any of the incoming-queue's unnaturally full (suggesting "hung" connections etc)? What's the memory usage like at the moment?".

Some of these (especially the simple stuff, like current free memory) must have been very useful to many developers for many years, but I cannot seem to find ANY java tools on the net that can be integrated into a compiled app (e.g. as a library) that can spew useful status-info. The nearest I could come up with is profilers and debuggers - neither of which is appropriate, because this is a production server where I do NOT need this stuff running 24/7, I just need to do an occasional "give me a snapshot of the status now, please" - even if that means server slowdown for seconds/minutes/etc.

Some of it is trivial to implement (e.g. getting at memory info from the Runtime class), but other things (like the status of a given Selector) are not so trivial. If I have to, I'll implement my own framework whereby every module supplies String[]'s of it's own status on demand - but surely this is reinventing the wheel?


FYI to anyone following this thread: I've had to roll my own. JMX is mainly just a poorly-documented wrapper around SNMP. SNMP unfortunately lives up to it's name (*simple* NMP) and only supports 3 commands:


  • get
  • getnext
  • set


So it doesn't handle sending command commands (e.g. "reset now") to devices. It's an extensible protocol, and you *could* make special variables that whenever a manager called "get" on them actually executed some code - but that kind of hacking is almost always a very bad idea in the long run (especially when new people join your team and start trying to use the standard protocol in the ways it was meant to work - and find all sorts of weird stuff happening!).

It's also *extremely* complex, for a simple protocol Smiley. Once you are familiar with it all, it's not complex at all, but the time taken to get that familiar is time I could instead spend making something more suitable for my purposes from scratch.

malloc will be first against the wall when the revolution comes...
Offline Golthar

Junior Member




;)


« Reply #4 - Posted 2003-10-20 11:38:15 »

Actualy, my work project is a project on SNMP.
SNMP does what its suposed to do and nothing extra.

The protocol is simple to implement, but very powerful.
You can get variables you need and doing a server restart might be done by creating a variable that should be set to restart (and which is set back to normal after it is done)

SNMP v1 doesn't do much in the ways of security however..

Back on topic, im kinda interested in this too, especialy when I hear of little evils like selectors deadlocking on close() calls.

Perhaps looking at the behamoth called JBoss may reveal some perls of wisdom?

come visit us: http://www.otf1337.com
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2003-10-20 12:01:16 »

Quote

The protocol is simple to implement, but very powerful.


Well, in the same way that the Turing Calculus is all-powerful, yes. But evaluated as a management protocol, it looks pretty pants to me ;P.

Quote

Back on topic, im kinda interested in this too, especialy when I hear of little evils like selectors deadlocking on close() calls.

Perhaps looking at the behamoth called JBoss may reveal some perls of wisdom?


I'm not sure what you could get from looking at e.g. JBoss. Either there's a standard, or you have to roll your own. If JBoss does something, that won't per se make a standard, so you'll still have to roll your own...unless they have a standalone system similar to JMX (but easier to use and much more powerful), and which can be embedded royalty-free without a darn GPL or similar?

Looks like we'll be supporting SNMP for data management, but our preferred mgmt sytems are proprietary - just because there's nothing suitably simple, powerful, standard AND inexpensive out there Sad.

malloc will be first against the wall when the revolution comes...
Offline tortoise

Junior Member




<3 Shmups


« Reply #6 - Posted 2003-10-20 20:01:11 »

Quote

JMX is mainly just a poorly-documented wrapper around SNMP.


JMX is its own technology, and really has little to do with SNMP. At my last job I implemented a large JMX server/client combo on a database system. JMX actually is pretty simple, and if you use MX4J (http://mx4j.sf.net/), it's fairly nice. The reference implementation of JMX stinks, and the commercial ones, partically Sun's, are very expensive.

At its heart, JMX is a server and a bunch of Management Beans (MBeans). MBeans attach to something (usually an object) in your application and monitor it. The MBean needs to be specifically created for whatever it attaches to, generic MBeans are not common and generally not useful. Then the server can query all the MBeans that are installed in it and gather the current state of the system.

MBeans are not JavaBeans, nor are they a specific class or interface. Really they're just a class that is written in such a way that the JMX server can introspect on them with reflection. However, there are several "common practices" for creating MBeans.

The server by itself offers no interface. You need to attach what JMX calls an adaptor to the server to see what is going on. The default one is an HTML adaptor, which enables you to monitor your system from a webpage. The HTML Adaptor that comes with the reference JMX implementation is terrible, and MX4J's is not much better. It's cryptic, and you really need to know JMX quite well to use it.

JMX also offers timers to schedule things, and so you can schedule your system to do various things at certain times, much like a Java cron. There are also gauges, which keep track of a certain attribute of an MBean and trigger an event if they go over a specified threshold. MX4J goes a bit further and offers things like email notification, an RMI adaptor, etc.

JMX really is simple, but yes it is poorly documented. My main server program with MX4J was about 20 lines of code (pretty much just getting the server up and running and installing some MBeans). Then from there it was all just writing MBeans. I also wrote a Swing interface using the RMI adaptor, because not only is the HTML adaptor cryptic, it's also very limited in what it can do. The end result was actually pretty cool.

JMX's achilles heal is no predefined interface that's easy to use and desirable. Really, the HTML interface is just terrible. The commercial implementations probably offer something better, and of course there is JBoss. Writing that Swing interface was easily 90% of the effort for the system, a pretty big waste IMO.

Also, JMX pretty much forces you to bend your application to its needs. Our application had to change such that the JMX server came up first, then it brought up the main app. Bringing up a new JMS queue became install a new queue MBean that would then start the new queue, etc. In certain situations this can be unacceptable.

I wish I had access to the intranet, I wrote pages and pages on JMX Smiley
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2003-10-22 03:02:44 »

Is this the stuff you were looking at before going to JMX?

http://java.sun.com/products/jdk/1.2/docs/guide/jvmpi/jvmpi.html
note: "The JVMPI is not yet a standard profiling interface."

http://java.sun.com/products/jpda/doc/architecture.html

Intersting side note: jvmstat works on 1.4.2 now .. I'm not sure  when it was upgraded.
http://developers.sun.com/dev/coolstuff/jvmstat/

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2003-10-22 14:18:56 »

Thanks for the info. I can honestly say that you've written more real info in just a few paras about JMX than any of us could find in two or three days of searching (everything was either articles that were 99% waffle, or else so completely impenetrable it was impossible to understand what on earth they were talking about).

But I'm still confused.

Quote


JMX is its own technology, and really has little to do with SNMP. At my last job I implemented a large JMX server/client combo on a database system. JMX actually is pretty simple


But, if I understand correctly what you've said, JMX actually is...nothing. It doesn't do anything. Like the JavaBean, it is nothing more exciting than a convention for class design? (it sounds like it isn't even a concrete interface).

My reading of the official docs from Sun (or at least the marketing spiel, which seems to be the main "documentation" they provide Sad) made it sound like the primary purpose was to simplify SNMP implementation in Java, whilst trying to be a little bit more generic - although no concrete reason was given for being more generic.

In particular:
Quote

At its heart, JMX is a server and a bunch of Management Beans (MBeans). ... The MBean needs to be specifically created for whatever it attaches to, generic MBeans are not common and generally not useful.
...
MBeans are ... just a class that is written in such a way that the JMX server can introspect on them with reflection. However, there are several "common practices" for creating MBeans.

The server by itself offers no interface. You need to attach what JMX calls an adaptor to the server to see what is going on. The default one ... is terrible.


You see, all that (and all the stuff you mention later) is so easy to do it sounds like you could create it from scratch in less time than it took to find, read, and understand the docs for JMX, then implement what you needed in JMX? It sounds like you end up doing all the hard stuff yourself anyway, so what's the poin of jumping through a JMX-shaped hoop?

Now, I can see a lot of value in an SNMP-supporting mgmt tool. Most enterprises and/or serious network admins have fancy remote SNMP management apps which nicely integrate all sorts of functionality in one place, and they appreciate being able to keep on managing things centrally, so to speak.

But I'm still left wondering, What's the point of JMX?

malloc will be first against the wall when the revolution comes...
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #9 - Posted 2003-10-22 14:41:14 »

Quote
Is this the stuff you were looking at before going to JMX?


Personally, I'm not interested in using JVMPI at the moment: that's really for low-level info gathering. I'm mainly doing high-level metrics, e.g. my original example of checking how full the "pending" queues are on a Selector. Some of those things do require JVMPI, but for the most part they don't.

I was mostly looking for a framework (e.g. JMX - although AFAICS this is a very sparse framework ATM; but I'm still struggling to appreciate it so I don't really know Smiley) that could do a lot of the work in instrumenting things for you. At the very least a set of non-generic interfaces that define a cohesive architecture would be nice.

Quote
Intersting side note: jvmstat works on 1.4.2 now .. I'm not sure  when it was upgraded.
http://developers.sun.com/dev/coolstuff/jvmstat/


That sounds like it's quite cool.

"sounds like". Both the doc-link and the download link for the 1.4.2-compatible version result in:

"Page Not Found
We are sorry, the page your requested was not found on our system. Based upon the url that you requested, we would like to recommend pages that match your requested url. If you prefer, you may navigate through our site or use our search for your page.

If you are certain that this URL is valid, please send us feedback about the broken link.
Your URL:   http://developers.sun.com/dev/coolstuff/jvmstat/v2/policy.html"

Given that 1.4.1 + NIO is like playing russian roulette with your sanity, and we're using NIO exculsively, this makes it kinda difficult to play with it Sad.

Also need to try and find more info on the licensing. The generic "CoolStuff license" linked to from the page is *so* generic that it's not clear how applicable it is. It would be nice to get some clarification. I'll see if I can find some.

malloc will be first against the wall when the revolution comes...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #10 - Posted 2003-10-22 15:00:28 »

Quote


Thanks for that link....I'd not seen JDPA before (at least, not since it began working with Hotspot), and it has quite a lot of things I've been wanting.

malloc will be first against the wall when the revolution comes...
Offline rreyelts

Junior Member




There is nothing Nu under the sun


« Reply #11 - Posted 2003-10-22 19:07:19 »

Quote
Thanks for that link

You might want to be careful about invoking methods on objects in the debugee VM. My personal experience was that, on an arbitrary basis, the thread would just seem to hang. There doesn't seem to be any good sources for information on JPDA so I couldn't really see if anybody else was stumbling on that problem - though I talked to the author of JSWAT and he said that he always does the invokes in a separate thread, because they seemed to have arbitrary latency. YMMV

God bless,
-Toby Reyelts

About me: http://jroller.com/page/rreyelts
Jace - Easier JNI: http://jace.reyelts.com/jace
Retroweaver - Compile on JDK1.5, and deploy on 1.4: http://retroweaver.sf.net.
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #12 - Posted 2003-10-23 02:56:43 »

Quote
That sounds like it's quite cool.

"sounds like". Both the doc-link and the download link for the 1.4.2-compatible version result in:

"Page Not Found ...


Must have been a temporary glitch - I got it without problems.

t is neat to see how often the eden generation is collected compared to the old generation.. That technique sure seems to pay off.

[aside]
My new fun thing to watch is the output of the JVM when you use -XX:+PrintCompilation
I just wish I knew what the info meant before the method signatures
1  b   java.lang.String::charAt (33 bytes)
2 s b   blah.blah.balh:...
3  !b  blah.blah.balh:...
4 * b  blah.blah.balh:...
The 'b' is always there.. but the 's' '!' or '*'  seem to mean something special.  I think '*' means that it backed out the compiled version.. because I always see that with "(0 bytes)"... maybe 's' is for synchronized methods..

jvmstat gives you a graph of time spent compiling but it doesn't tell you what was compiled.

Another cool bit of trivia is that it compiles 16 methods before it ever loads your"main" class (tested it by giving a bogus class on the command line)

Offline tortoise

Junior Member




<3 Shmups


« Reply #13 - Posted 2003-10-23 04:36:41 »

Quote

But, if I understand correctly what you've said, JMX actually is...nothing. It doesn't do anything. Like the JavaBean, it is nothing more exciting than a convention for class design? (it sounds like it isn't even a concrete interface).


It's definitely a loose technology. The heart of JMX is really the server, which is provided for you in the JMX implementation. It manages communication (MBean to MBean, MBean to adaptor, event to MBean, etc), provides MBeans with a context in which to send in their management data, and manages things like remote RMI connections, sending emails out etc (although the last two are MX4J extensions). It's not a simple program, and all you have to do is instantiate one and tell it to start.

JMX is also very modular. Kind of like SiteScope but more sophisticated. If you add a new component, you can easily whip up an mbean for it and have it managed within your system very quickly. For example JBoss attaches MBeans to everything. You can fire up JBoss and connect to the JMX HTML adaptor, and you'll get a list 5 miles long of MBeans and their stats. It's cryptic as can be, but if you know JMX you can know every detail of your JBoss system at a glance, not to mention tweak anything you want.

Quote

It sounds like you end up doing all the hard stuff yourself anyway, so what's the poin of jumping through a JMX-shaped hoop?


If you had an existing java application that you wanted to manage, attaching bean like objects to various parts is easier than reconfiguring the app to have management info built into classes (not to mention more modular). Since you're going to be writing these bean like classes anyway, mine as well follow the MBean conventions and end up being able to plug them into a premade server.

Quote

Now, I can see a lot of value in an SNMP-supporting mgmt tool. Most enterprises and/or serious network admins have fancy remote SNMP management apps which nicely integrate all sorts of functionality in one place, and they appreciate being able to keep on managing things centrally, so to speak.


That's what JMX does too, it's just younger. So that central management app is that HTML interface I was talking about, which needs a lot of work. I'll bet commercial JMX implementations have a nice management center.

Quote

But I'm still left wondering, What's the point of JMX?

I dunno. I'm definitely not an advocate of it or anything, just was told to use it. I think in time it could prove to be nice. I think a lot of the Java community (like JBoss) likes it just because it is a Java standard, and so is a "good bet".

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (26 views)
2014-09-07 01:12:14

Longarmx (33 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (39 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!