
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
github.com/ahmadmuzakkir/redis-elasticsearch-go-example
This project shows an example how to design a system.
Below is the system description:
Design a basic analytics backend that can store and query hits. A hit is an interaction that results in data being sent to the backend.
A hit is identified by a unique ID of type string.
The system should provide two APIs:
1. Track (store) a hit.
2. Retrieve a hit's counts for the last 5 minutes, 1 hour, 1 day, 2 days and 3 days.
Refer to endpoints documentations for more information.
In this section, we will explain how the system is designed.
We make some assumptions and estimations about the system.
The system has to track hits for an ID.
The system has to return hit counts for an ID.
We can either store individual hits or aggregate hits in real time.
We choose to store individual hits since it's the simplest solution, and more flexible. The trade off is reads may be slow, and it will consume more storage.
Below is the hit model:
{
"id": "string",
"timestamp": "string"
}
The query that will be performed is an aggregation based on time ranges.
Based on the information above, below is the system design details:
Track a hit.
Request
{
"id": "id"
}
Response
No Content
Retrieve hits counts for a hit.
Response
{
"id": "1",
"counts": [
{
"reference": "3 days ago",
"count": 3
},
{
"reference": "2 days ago",
"count": 3
},
{
"reference": "1 day ago",
"count": 3
},
{
"reference": "1 hour ago",
"count": 1
},
{
"reference": "5 minutes ago",
"count": 1
}
]
}
Prerequisites:
# build the docker image
[terminal 1] bash scripts/build.docker.sh
# run docker compose
[terminal 1] docker-compose up --build
Assuming default configurations, following are the available endpoints:
To clean up, you can do:
[terminal 1] docker-compose down -v
To simplify things, you can use the Makefile.
Build the docker image and run the docker compose.
[terminal 1] make run-docker
Stop and clean up the docker compose.
[terminal 1] make clean-docker
Prerequisites:
Some of the tests require ElasticSearch server. It's expected that the server is reachable at http://127.0.0.1:9200/
To make it easy, there's provided script that will start the ElasticSearch server in a Docker container and run the tests.
[terminal 1] bash run.tests.sh
You can spam Track request using benchmark tool in cmd/benchmark
directory.
The tool will spam Track requests as fast as possible, using a number of workers.
The default number of workers is 1, and you set it using -w
flag or env.
The default hit ID is 1
, and you can set it using -i
flag or env.
go run cmd/benchmark/main.go -w 1 -i hitid
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.