Very good talk. Uncle Bob.
Let’s say you need to keep track of certain values on your application, to decide whether is under-performing or achieving any given intended goal, etc… so you think about what you need to measure and decide to insert some KPI’s in your codebase.
Now think about what you need to measure… is it something that increments in time, or is it something that may increment and decrement? is it something which value depends on previous values, or is it something where we only care about the value on the moment of measurement, which won’t very likely be related to its value maybe a couple of minutes before?
In the first case you will need a counter. In the second, a gauge. Why do I make this distinction?, why is it important?, why are you probably reading this?, basically because any single monitoring software I’ve used make this distinction when creating a metric or defining an alarm. Zenoss, when defining a MIB; Nagios, when specifying the data source type…
Ok, yeah, very nice. But very theoretical. Give me some examples so I can understand this better.
There you go then. Examples:
– Number of concurrent visitors in a website: that’d be a gauge, we’re only interested in the number of visitors now browsing a website; grab it, record it, keep moving.
– Number of visitors in the last five minutes in a website: that’d be a counter, plus some basic arithmetics (current value – value five minutes ago).
– Memory use: gauge. We’ll send info on % of memory use at the time when the info is requested.
– CPU use: gauge, as the previous one.
– Number of requests: counter.
There is a bit of complication when you want to measure how many times something happens in certain amount of time, since you need a counter to track down the number of occurrences of the event, but you need to keep track of the previous value of the counter when the time interval comes to an end. To make your life easier, some libraries written to help you track down values for your KPI’s contemplate a third type of metric, called, precisely, meters… but that’s getting out of the scope of the present post.
Just so you know. That’s why it’s a release candidate…
If you are new to Lucene, like me, and you are struggling to find documentation, or, better, you’re finding too much documentation… this is what I did to find out what this is about…
1.- Read this.
2.- Do this example. I have mavenized the project.
3.- Read this.
4.- Create your first project searching files from a local directory with the classic IndexFiles and SearchFiles classes from Lucene, as advised in the previous point reading.
5.- Create your first project searching text from a local database tables content. You may want to read this before.
6.- Address any possible performance issues.
7.- Put Luke in your Lucene-life. This tool will let you query in your indexes a very friendly manner, among other things.
8.- To present results almost real time in an impressive fashion, give this a read.
As any other framework, though, as much as you work with it, more confident you will feel. I am just a beginner, so I suppose that this will be only useful for you if you’re starting too. Feel free to point out the next steps that I (or others to whom this post is useful) should be doing (resources, etc…) if you are an expert.
The best initiation.to.Tomcat post ever written. And there will be more. Cool.