Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Aerospike で 大量のトランザクション処理をさばく

ikosin
October 30, 2015

Aerospike で 大量のトランザクション処理をさばく

https://atnd.org/events/71301 での発表資料です。

ikosin

October 30, 2015
Tweet

Other Decks in Programming

Transcript

  1. Tokyo Tyrant & Tokyo Cabinet • ࠃ࢈ KVS • 2010

    ೥લޙ • memcache ޓ׵ϓϩτίϧͰσʔλӬଓԽ΋Մೳ • ϚελɾεϨʔϒܕͷϨϓϦέʔγϣϯػೳ • ϚϧνϚελߏ੒΋Մೳ • ·ͩ·ͩݱ໾Ͱಈ͍ͯΔͱ͍͏࿩΋ฉ͘ 
  2. Redis • σʔλӬଓԽՄೳ • ༷ʑͳσʔλߏ଄ͷ··อଘՄೳʢจࣈྻ, List, Set, ιʔτࡁΈSet, Hashʣ •

    ϚελɾεϨʔϒܕͷϨϓϦέʔγϣϯػೳ • Amazon ͷ ElastiCache ͰϑϧϚωʔδυͳαʔϏεͱͯ͠ར༻Մೳ • 2015೥4݄ʹग़ͨ Redis 3.0 Ͱ਱ʹ Redis Cluster ͕ਖ਼ࣜϦϦʔεʂ 
  3. DynamoDB • Amazon ͷϑϧϚωʔδυͳNoSQL σʔλϕʔε • ௿ϨΠςϯγ • ߴεϧʔϓοτ •

    ߴՄ༻ੑ • ߴ͍εέʔϥϏϦςΟ • ͓ۚΛ෷͑͹શͯͷ໰୊͸ղܾ͞ΕΔʂ 
  4. ௿ϨΠςϯγɾߴεϧʔϓοτ • ҎલɺAerospike ͷதͷਓͷهࣄΛ຋༁͠·ͨ͠ • Aerospike on Amazon EC2 Ͱ

    100ສTPS Λͨͬͨ 1.68 υϧ /࣌ Ͱ࣮ݱ͢Δํ๏
 https://fa-works.com/blog/1-aerospike-server-x-1-amazon- ec2-instance-achieve-1-million-tps • C3.8xlarge 1୆Ͱ 100ສTPS ͷ Read ϦΫΤετΛॲཧ • 97% Ҏ্ͷϦΫΤετΛ 1ms Ҏ಺ʹฦ٫ʢຊՔಇதͷαʔόʣ 
  5. σʔλ৑௕Խ • ϨϓϦέʔγϣϯɾϑΝΫλ (replication factor) ͱ͍͏ ύϥϝʔλͰσʔλͷෳ੡ͷ਺ΛࢦఆͰ͖Δ • replication factor

    = 2 ͷ৔߹ɺϝΠϯͰΞΫηε͢ΔϚ ελσʔλͱ͸ผʹɺଞͷαʔόʹ 1ͭϨϓϦΧσʔλ ͕ଘࡏ͢Δ • 1 ୆Ϋϥογϡͯ͠΋ɺϨϓϦΧͷσʔλ͕ੜ͖͍ͯΔ ͨΊσʔλΛϩετ͠ͳ͍ 
  6. ࣮૷্Ͱ஫ҙ͢Δ఺ • Limit • Setʢςʔϒϧʣͷ਺ => 1024ݸҎ಺ • BinʢΧϥϜʣ໊ =>

    14จࣈҎ಺ • Record ௕ => ʢσϑΥϧτʣ128KB ʢ࠷େ1MBʣ • http://www.aerospike.com/docs/guide/FAQ.html 
  7. ࣮૷্Ͱ஫ҙ͢Δ఺̎ • ClientLibrary ಺ͰͷγϦΞϥΠζ͕݁ߏඍົ • SecondaryIndex Ͱͷෳ਺ΠϯσοΫεͷ And ݕࡧෆՄ •

    SecondaryIndexͰɺIn ͕۟ͳ͍ • Range ͸αϙʔτ͞Ε͍ͯΔ͕ɺจࣈྻΛҾֻ͚ͬ ʹ͍͘ 
  8. མͱ݀̍͠:κϯϏϨίʔυ໰୊ Delete & TTL ʹΑΔ Expire ͸࡟আͰ͸ͳ͍ʂʂ • ϝϞϦʹࡌͤͯ͋ΔΠϯσοΫεʢPKʣΛ࡟আ͢Δ͚ͩ ͰɺετϨʔδ͔Β͸ଈ࠲ʹফ͑ΔΘ͚Ͱ͸ͳ͍

    • SSD ͷಛੑ্ɺσʔλ࡟আ͸ෛՙ͕ߴ͍ • σϑϥάͷ͍ͭͰʹ্ॻ͖ʢ͍ͭফ͑Δ͔ෆ໌ʣ • ௨ৗΞΫηε͸ग़དྷͳ͍ͷͰ໰୊ͳ͍͸ͣͩͬͨ... 
  9. མͱ݀̍͠:κϯϏϨίʔυ໰୊ ͨͩ͠ɺAerospike Λ࠶ىಈͨ͠Β෮׆͢Δʂ • Aerospike ىಈ࣌ʹɺετϨʔδ͔Β PK ΛಡΜͰϝϞϦ ʹΠϯσοΫεΛߏங͢Δ •

    ࡟আ͞ΕͨϨίʔυͱ͞Εͯͳ͍Ϩίʔυͷ۠ผ͕ͳ͍ʂ • ࡟আͨ͠Ϩίʔυ΋ҰॹʹΠϯσοΫε͞ΕͯಡΈऔΓͰ ͖ΔΑ͏ʹͳΔʂʂʁ 
  10. ωοτϫʔΫ • Amazon ͷΧλϩάεϖοΫ͸ 10G Ҏ֎͸ Low ͱ͔ High ͱ͔ϘΧͨ͠஋

    • ಉ͡ High Ͱ΋ΠϯελϯελΠϓʹΑ͔ͬͯͳΓҟͳΔ • iperf ౳Ͱܭଌͨ͠ํ͕͍͍ʢެ։ͯ͘͠Ε͍ͯΔਓ΋͍Δʣ • http://qiita.com/saitara/items/882a3e70639637e24a4f • ྫʣc4.2xlarge => 1.01 Gbits/sec • ྫʣc4.4xlarge => 4.27 Gbits/sec 
  11. Disk IO & εϧʔϓοτ • EBS ͸஗͗͢Δ • ඞཁͳ IO

    ੑೳΛग़͢ͷ͸ Provisioned IOPS Λར༻͢Δ ͜ͱͰ࣮ݱͰ͖Δ͕ɺߴ͍ʂ • ΠϯελϯεετϨʔδ Λ࢖͏ • ෺ཧతʹܨ͕͍ͬͯΔετϨʔδͳͷͰૣ͍ʂ • ͨͩ͠ɺΠϯελϯεͷ stop/start Ͱσʔλ͸شൃ͢Δ