RESTX Stats
Restx let you choose to collect and share stats on your application to give information to the RESTX community.
These statistics are helpful to hava a better idea on how RESTX is used, and therefore try to improve it in the right direction.
Design
Collecting and sharing stats in RESTX has been designed with the following principles in mind:
easy opt out
It is implemented in a separate module called restx-stats-admin
, if you don’t include it you don’t get any stats collected, so it’s purely optional.
So if you don’t want to have stats in your restx application, simply make sure you have no dependency on the restx-stats-admin
module.
anonymous stats only
no information on the application name, the packages, …
Here is how stats look like:
minimal impact on performance
Collecting stats has a very low overhead, we have done load tests on a “realistic” application using MongoDB to access data, and the load test doesn’t show any significant difference with and without stats collecting.
For the details, here are the results:
Note that you shouldn’t take these results as an indication of how RESTX performs. This load test was run with everything on a single box, without trying to reach the limits nor fine tune the test.
Moreover, the module does not starts any additional threads, it uses the request processing to collect stats, but also to save and share them.
On disk saving is only done once every 5 minute by default (and you can configure it), and sharing stats is only done once every 10 minutes by default (and you can configure it too).
Both of these are done in the request processing thread, but after the response has been returned, so it has no impact on the request processing time. It only affects the time taken to return the thread to the thread pool used for request processing.
easy configuration
Easily configure if you want to store stats between run (so that it can also work on platforms where disk access is disabled), and if you want to share them (so that you can benefit from these stats only for you, and don’t share them with the community).
Here are the keys you can use to configure the module:
restx.stats.storage.enable
enable or disable the storage of restx stats on the file system, allowing to gather statistics over multiple run
restx.stats.storage.dir
the directory in which stats should be stored
restx.stats.storage.period
the period, in ms, at which stats are saved to disk
restx.stats.share.enable
enable or disable the sharing of restx stats, allowing the community to collect statistics of RESTX usage. See http://restx.io/stats.html for details.
restx.stats.share.url
the URL on which stats should be shared (using a POST)
restx.stats.share.period
the period, in ms, at which stats are shared
Open source
As the rest of RESTX, the stats module is open source, so you can have a look at the source code to know for yourself what it’s doing.
The main classes are:
- the stats themselves called
RestxStats
, - the stats collector, called
RestxStatsCollector
.