2014-03-26 2 views
1

온라인에서 약간의 연구를 한 후에, 나는 두 벤치 마크 비교를 많이 찾을 수 없었습니다. 나는 하나의 redis vs mongodb : (How much faster is Redis than mongoDB?)를 찾았다.Postgres보다 redis가 얼마나 빠릅니까?

레일즈에서 두 개의 단순하지 않은 코드를 실행하는 내 비공식적 인 테스트에 따르면, 필자는 쓰기가 같다고 추측하지만, 읽기는 약 2 배 빠릅니다. 내 전망이 보통 50ms ~ 150ms라고 생각할 때 예상했던 것보다 큰 속도 이점이 아닙니다.

제 질문은 두 가지에 대해 "거친"아이디어를 줄 수있는 다른 벤치 마크가 있습니까? 두 가지 모두의 컨벤션 구성으로, 아마 heroku 기본 dyno와 postgres 서비스에 대해 테스트 할 수 있습니까? 고맙습니다!

##NOTICE: #follow is implemented with Redis. #public is just a postgres ActiveRecord property. 
[93] pry(main)> Benchmark.measure{ 100.times { c.public = !c.public; c.save; c.public = !c.public; c.save}} 
=> #<Benchmark::Tms:0x007faeb3c814f0 
@cstime=0.0, 
@cutime=0.0, 
@label="", 
@real=0.743117, 
@stime=0.03000000000000025, 
@total=0.6000000000000005, 
@utime=0.5700000000000003> 
[94] pry(main)> Benchmark.measure{ 100.times { u.unfollow! u2; u.follow! u2 }} 
=> #<Benchmark::Tms:0x007faeb1409c20 
@cstime=0.0, 
@cutime=0.0, 
@label="", 
@real=0.988483, 
@stime=0.14000000000000057, 
@total=0.8800000000000026, 
@utime=0.740000000000002> 
[95] pry(main)> Benchmark.measure{ 100.times { u.follows? u2 }} 
=> #<Benchmark::Tms:0x007faeb2f22ea8 
@cstime=0.0, 
@cutime=0.0, 
@label="", 
@real=0.045072, 
@stime=0.009999999999999787, 
@total=0.06000000000000405, 
@utime=0.05000000000000426> 
[96] pry(main)> Benchmark.measure{ 100.times { Course.first.public? }} 
=> #<Benchmark::Tms:0x007faeac97b8c0 
@cstime=0.0, 
@cutime=0.0, 
@label="", 
@real=0.11811, 
@stime=0.0, 
@total=0.09000000000000341, 
@utime=0.09000000000000341> 
+0

내가 Postgres와 Redis Object Storage Benchmark에 대한 링크를 제공하면 도움이 될 것입니다. – Pavan

+0

@Pavan, 네, 도움이 될 것입니다! – randomor

+0

이 카드가 아니라면 https://gist.github.com/NateBarnes/3001890 세트가 약 2 배 빠르며 1 배 빠릅니다 ... – randomor

답변

0

Redis는 키 - 값 저장소 데이터베이스이며, Postgres는 RDBMS입니다. 키 - 값 데이터베이스를 사용하면 데이터가 스키마가 저장되지만 관계형 데이터베이스는 저장되지 않습니다.

두 가지 방법 모두 장단점이 있습니다. 자세한 내용은이 기존 stackoverflow post을 참조하십시오.

관련 문제