Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashwanikumar04/distributed-site-hit-counter
Distributed site hit counter
https://github.com/ashwanikumar04/distributed-site-hit-counter
Last synced: 12 days ago
JSON representation
Distributed site hit counter
- Host: GitHub
- URL: https://github.com/ashwanikumar04/distributed-site-hit-counter
- Owner: ashwanikumar04
- License: apache-2.0
- Created: 2018-06-20T08:47:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-21T08:14:04.000Z (over 6 years ago)
- Last Synced: 2024-11-08T02:16:04.292Z (2 months ago)
- Language: Java
- Size: 146 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
- [Commands](#commands)
- [Install load balancer](#install-load-balancer)
- [Start load balancer](#start-load-balancer)
- [Build](#build)
- [Run 1st instance](#run-1st-instance)
- [Run 2nd instance](#run-2nd-instance)
- [API](#api)
- [Increase counter](#increase-counter)
- [Get current counter](#get-current-counter)This project shows one of the ways of implementing distributed site hit counter using GCounter (CRDT).
## Commands
### Install load balancer
```bash
npm install -g loadbalancer
```### Start load balancer
```bash
loadbalancer start --config load-balancer-config/config.json```
### Build
```bash
./gradlew clean build
```### Run 1st instance
```bash
java -jar build/libs/distributed-site-hit-counter-0.0.1-SNAPSHOT.jar --server.port=9091```
### Run 2nd instance
```bash
java -jar build/libs/distributed-site-hit-counter-0.0.1-SNAPSHOT.jar --server.port=9092```
## API
### Increase counter
```bash
curl -X GET \
http://localhost:9000/increment
```### Get current counter
```bash
curl -X GET \
http://localhost:9000/counter
```