juan_gandhi: (Default)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2009-10-01 04:55 pm

foofl varz

There's a lot of foofl technologies now widespread and commonly accepted; it seems like there are some still unknown.

Foofl varz.

If you run a foofl server (either c or java version) on internal network, it will serve a nice page called /varz

What it does is just displaying public static values with their names.

I do not know much about how it's done in c (okay, there are stupid macros there; I used it and immediately forgot), but in Java there's a nice class called Varz.

You instantiate it, giving it a name, and register it. So that varz servlet scan all existing varz and displays their values. You can scan them in your code of course; that's how I had implemented varz setter in orkut, so that our qa could reconfigure their qa servers without rebooting - just change a varz (your change will be logged, with your login name), and the code that relies on a varz value will work differently. command line parameters are also stored in varz, by the way.

Now not all varz in Java are the same. Some varz store strings, others store integers or longs or doubles. Some varz are used for statistics. So that you just bump a varz, and, on the page, you can see the frequency, averaged per 10 minutes, per hour, and the like. Extremely useful to count hits, functionality usage, failures, anything. We were actually required, when implementing a new feature, to provide a varz that would show the percentage of its usage.

Then what. Since your server serves a varz, in a uniform way (it can probably serve it as xml as well, I forget), you can configure borgmon to grab varz from a server farm, doing some integration, and voila, you see the graph. The waves of millions of users that discover the new feature and start using it. All due to a pretty simple class.

It is kind of strange that this is not practiced by everyone around the world. People say, we use logs. Right. You have to write elaborate parsers, waste a lot of time and efforts, to see something from yesterday. With varz, you see stuff right away, as it develops. Security team can immediately see a suspicious behavior - when one of the varzs suddenly peaks. Or a bug. :)

[identity profile] ivan-gandhi.livejournal.com 2011-01-13 11:26 pm (UTC)(link)
Ояебу; у них там некому больше доки приличные писать для просветлённого человечества.

Спасибо, насмешили!