How to use Redis HyperLogLog | HackerNoon

  • 📰 hackernoon
  • ⏱ Reading Time:
  • 77 sec. here
  • 3 min. at publisher
  • 📊 Quality Score:
  • News: 34%
  • Publisher: 51%

United States Headlines News

United States Latest News,United States Headlines

'How to use Redis HyperLogLog' redis hyperloglog

Nowadays, every project collects analytics data. Therefore, it can be easy to understand users and their needs based on the data. For example, one of the everyday tasks in this area is to count unique visits to web pages.

Let’s imagine that a popular media resource is being developed. The website traffic is approximately equal to 500 million unique visitors per day. And there is a task to cache the number of visits of each page in Redis with the ability to write/read as fast as possible and obtain general statistics for multiple pages. An IP address identifies each unique visit.At first, you can use the built-in Sets data structure in Redis.

127.0.0.1:6379> sadd page:1 113.145.236.211 159.54.101.236 207.47.30.26 3 127.0.0.1:6379> sadd page:2 113.145.236.211 36.186.119.48 2 127.0.0.1:6379> sinter page:1 page:2 1) "113.145.236.211" The Sets data structure seems to be an excellent solution for the case. But it’s not. Redis Sets can be used only in small or medium projects. Considering that the task includes 500 million visits per day, the resource is under a high load. To store all the data in Sets, you need a lot of RAM. Also, Redis would consume a huge amount of time to process millions of items.Fortunately, Redis has the HyperLogLog data structure to store many unique events, and it takes up a constant amount of memory.

If new values are successfully written, one is returned. However, if you try to insert an existing value, 0 will be returned:To get the number of unique visitors, use the127.0.0.1:6379> pfcount page:1 5 127.0.0.1:6379> pfcount page:2 5 127.0.0.1:6379> pfcount page:3 5pfmerge destkey sourcekey [sourcekey ...]command merges several HyperLogLog keys into a single one.

 

Thank you for your comment. Your comment will be published after being reviewed.
Please try again later.
We have summarized this news so that you can read it quickly. If you are interested in the news, you can read the full text here. Read more:

 /  🏆 532. in US

United States Latest News, United States Headlines

Similar News:You can also read news stories similar to this one that we have collected from other news sources.

Build a Job Application Tracker in 10 minutes Using ToolJet's Low Code Tool | HackerNoonIn this article, you'll learn to build an app that will let you manage all your job applications right from your own personal dashboard.
Source: hackernoon - 🏆 532. / 51 Read more »

Web Push Notifications for Javascript Apps Using Firebase | HackerNoonA tutorial on integrating Firebase Cloud Messaging to a Javascript app to turn on push notifications in a browser
Source: hackernoon - 🏆 532. / 51 Read more »

Hosting an Angular Application on Amazon S3 Using Github Actions | HackerNoonApplication example built with Angular 13 and hosted on Amazon S3 (Simple Storage Service) using GitHub Actions.
Source: hackernoon - 🏆 532. / 51 Read more »

Recent Hacks in the Crypto and Defi Spaces Show the Security Loopholes | HackerNoonOver the past year, we have seen a massive jump in activity and value for the crypto and decentralized finance (DeFi) spaces.
Source: hackernoon - 🏆 532. / 51 Read more »

10 NoCode Tools to Help You Build Your MVP 🚀 | HackerNoonA list of 10 free Nocode tools for creating and launching a successful startup ✅🚀 anjalbinayak Help me pleass
Source: hackernoon - 🏆 532. / 51 Read more »

Interactive Content Is Changing Customer Experience (CX) For Good | HackerNoon'Interactive Content Is Changing Customer Experience (CX) For Good' customerexperience interactivecontent
Source: hackernoon - 🏆 532. / 51 Read more »