Redis Hackathon - Sanic 환전 API
내 제출물 개요

이 제출은 PostgresDB를 사용하는 것에서 Redis Stack(RedisJSON)을 데이터 저장소로 사용할 수 있도록 내 애플리케이션(Sanic Currency Exchange API)을 전환하는 것입니다. 다이어그램에 표시된 것처럼 작업의 세 부분이 포함되어 있습니다.

아이디어
I cloned this Currency API (Github link below) about 3 years ago and kept maintaining it. The initial thoughts were maintaining the dependencies to avoid some security problems. Gradually, I started to re-write the application codes to make it more maintainable, readable. (This is a long way to go, I am sure it has not been finished yet, 😀)
이 API는 유럽 중앙 은행에서 환율을 가져오고 RESTful API에서 환율을 제공하는 것입니다.
. 이전에는 애플리케이션의 캐싱 레이어로 Redis를 사용했지만 Redis 모듈을 사용하는 것은 이번이 처음입니다. 이 구현은 개선해야 할 부분이 많을 것입니다. 의견을 남겨주시면 Redis JSON 및 Redis Stack 모듈에 대해 자세히 알아볼 수 있습니다.

제출 카테고리: MEAN/MERN Mavericks
데이터 저장 방법:
데이터는 환율의 각 날짜에 대한 문서로 저장됩니다.
{
"2020-01-01": {
"USD": 1,
"EUR": 1.1,
"AUD": 0.97
}
}
데이터 액세스 방법:
파이썬 코드에서 데이터는 간단한 get을 통해 액세스됩니다.
r.json().get('2020-01-01')
사용 언어
코드 링크
팀 허브 / sanic-통화-환율-api
이것은 자체 호스팅된 무료 오픈 소스 Python Currency Exchange Rate API 포크입니다.
Redis Stack @Redis Hackathon을 사용하기 위해 Sanic Currency Exchange Rates Api 마이그레이션
Use Redis Stack (RedisJson) to replace Postgres as main storage, plus some refactoring

Use Redis Stack (RedisJson) to replace Postgres as main storage, plus some refactoring
작동 원리
데이터 저장 방법:
데이터는 환율의 각 날짜에 대한 문서로 저장됩니다.
{ "2020-01-01": { "USD": 1 "EUR": 1.1, "AUD": 0.97 } }
데이터 액세스 방법:
Python 코드에서 데이터는 단순
get
을 통해 액세스됩니다.r.json().get('2020-01-01')
성능 벤치마크
Load test은 여기에서 성능을 측정하는 데 사용됩니다.
여기서 2가지 주요 결과는
iterations
(높을수록 좋음) 및 iteration_duration(avg)
(낮을수록 좋음)입니다.사실
포스트그레스
레디스 스택
반복
25.26/초
5.52/초
반복 기간
560.15ms
5.53초
이 성능 벤치마크는 나 자신에게 놀랍습니다.
View on GitHub
추가 리소스/정보
협력자
솔로 제출입니다.

Reference
이 문제에 관하여(Redis Hackathon - Sanic 환전 API), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/timhub/redis-hackathon-sanic-currency-exchange-api-132e텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)