❱ 🐇 URL shortener service is written in Scala using Akka-Http and Redis ❰
❱ reduc.io ❰
URL shortener service
http://reduc.io/wuXaq
Tech stack
Alternative solutions
We could use following short code gen also:
substr(base62(md5(url)), 6) = 62 ^ 6 //unique short urls
Commands
Run
Run docker-compose
, it will start api
, redis
and will expose api port to host.
docker-compose upSample usage
# Shorten curl -i http://localhost:9001 -F "url=https://www.amazon.com/Star-Wars-Battlefront-II-Digital/dp/B072JZZ4XD"Call shortened url
for ((i=1;i<=100;i++)); do curl -i "http://localhost:9001/SEwuXHhBQw"; done
Get Stats
returns: {"callCount":100}
Create executable
sbt packageBinTest
sbt testGatling Simulation
Simulation users count can be set in application.conf
in test resources.
# terminal 1 sbt runCoverage with ReportRun simulation in terminal 2
sbt gatling:test gatling:latestReport
sbt clean coverage test coverageReportImprovements
Redis
calls using Retry or similar onez i λ a s a l.
Twice a month we will interview people behind open source businesses. We will talk about how they are building a business on top of open source projects.
We'll never share your email with anyone else.