Skip to content

byeol-i/battery-level-checker

Repository files navigation

battery-level-checker

  1. System diagram
  2. User scenario
  3. rest API
  4. Table Relationship
  5. Running
  6. Performance Test
  7. Dependency

Purpose

The purpose of this project is to hands on learning experience about Kafka while impl a battery level checking application

System diagram

WIP

That System is constructed in several kafka brokers and middleware which use HTTP transport

Screenshot 2023-10-01 at 1 30 11 PM

User scenario

1. Register user

  • Getting token by firebase login

  • Create custom token (Using for generate access token)

  • Post to user date to server

2. Get devices

  • Added token at header

  • [HTTP]Get {domain}/api/v1/device

...

rest API

For detailed information about the API, Please read this documentation

Table Relationship

image

Running

To running this application, need to setup docker swarm system.

1. labeling worker at worker

docker node update --label-add kafka=1 {hostname}

docker node update --label-add kafka=2 {hostname}

...

2. Creating firebase api

locate firebase key at ./conf/firebase/key.json

3. Running zookeeper & kafka

docker stack deploy -c kafka.yml {stack name}

or

cd shell && ./deployZoo.sh && ./deployKafka.sh

4. Running auth, apid ...etc

cd shell && ./deployApp.sh

or just cd shell && ./deploy.sh

Performance Test

Test environment

  • tested on rpi4 x 4 cluster
  • Used Docker swarm
  • Each service(apid, auth, consumer) scaled to 3 instance
Screenshot 2023-10-01 at 12 21 56 PM

Test tool

  • test tool : jmeter
  • HTTP method : post
  • Thread : 2000
  • Ramp-up period : 1
  • Loop : 10

Summary report

Screenshot 2023-10-01 at 12 20 26 PM

Response time graph

Screenshot 2023-10-01 at 12 20 49 PM

Dependency

The following dependencies are used in the project:

Echo swagger

swag

echo

sarama

zap

go-cache

dateparse