Real-Time
Event Analytics
Stream and aggregate millions of user events per second with sub-millisecond ingestion latency.
Ingestion Architecture
Collecting clickstream data or server logs requires a database that can handle intense write bursts without blocking. VelocityDB uses Atomic Increments and Time-Series Bucketing to aggregate data on-the-fly.
Hot Counters
Instantly increment global or scoped counters (e.g., page views, button clicks) without the overhead of read-modify-write cycles.
Time Bucketing
Group events into time-based keys (minute/hour) to generate real-time trend charts with zero query latency.
Live Playground
Emit telemetry events and watch them get aggregated into high-performance buckets in sub-milliseconds.
H-Hash Ingestion Demo
Telemetry Stream Ingest
Track Event (Frontend)
Emit an event whenever a user performs an action. Velocity's high throughput allows you to track everything without affecting application performance.
// Analytics Tracker Utility
async function trackClick(buttonId) {
const timestamp = new Date().toISOString().substring(0, 13); // YYYY-MM-DD:HH
// Send to our fast ingestion endpoint
await fetch('/api/ingest', {
method: 'POST',
body: JSON.stringify({
event: 'click',
id: buttonId,
bucket: timestamp
})
});
}Atomic Ingestion (Backend)
Use `HINCRBY` to increment a specific field within a hash bucket. This is atomic and handles massive concurrency.
app.post('/api/ingest', async (req, res) => {
const { event, id, bucket } = req.body;
const key = `analytics:${bucket}`;
const field = `${event}:${id}`;
// Hyper-fast atomic increment
await client.hincrby(key, field, 1);
// Also update a global counter
await client.incr('global:events_processed');
res.status(202).send(); // Accepted
});Real-time Dashboard Query
Fetch the pre-aggregated buckets to populate your charts. No expensive "SUM" or "GROUP BY" needed.
app.get('/api/dashboard', async (req, res) => {
const buckets = getRecentBucketKeys(24); // Last 24 hours
const results = await Promise.all(
buckets.map(key => client.hgetall(key))
);
res.json({
history: results,
total: await client.get('global:events_processed')
});
});CLI Analytics
INCR page_viewsHINCRBY day:1 clicks 5HGETALL day:1Scale Tip
Use `PIPELINE` or `BATCH` mode to send multiple increments in a single network round-trip for even higher performance.