My talk at Topconf.com conference, Tallinn, 1st of November 2012

download My talk at Topconf.com conference, Tallinn, 1st of November 2012

If you can't read please download the document

Transcript of My talk at Topconf.com conference, Tallinn, 1st of November 2012

  • 1. Tarantool/Box: a use case withserving 2 billion queries a dayNovember 1st, 2012, Tallinn, EstoniaKonstantin Osipov, [email protected]

2. AgendaTarantool/Box: features and architectureCase study 1: advanced memcacheCase study 2: a message queue serverCase study 3: a reliable in-memory databaseProject future 3. Feature overviewFlexible data model, primary and secondary keysFully cached: 100% of data is cached in RAMPersistent using a Write Ahead LogLog shipping replication and online backupextensible with Lua 4. Data modelA game of fields, tuples and spacesHASH, TREE, BITMAP, partial, indexesSecondary keysSingle-part, multi-partSTRING, NUM and NUM64 data types 5. Server architecture 6. Lua APIRedis Tarantool (Lua)redis.set(key, value) box.insert(space, key, value)redis.get(key)box.select(space, 0, key, value)redis.getset(key, newkey)box.update(space, key, =p, 0,newkey)redis.incr(key) box.update(space, key, +p, 1, 1)redis.lpush(key, value) box.update(space, key, !p, 1, value)redis.rpush(key, value) You guess it... 7. Performance overviewIntel I5 , 4G RAM, 7200 RPM SATA10 threads, 200-300 bytes per tupleTarantool 1.4.6: 170k writes,260k reads 8. Memory footprint 9. Raw GET/SET performance 10. Use case 1: flexible memcacheYou can create your own fibersbox.fiber.create(), box.fiber.yield()A background fiber performs a customized expire Session store: 20M online users, 200M monthly users,4 2-CPU units, 96GB RAM each60K RPS, CPU usage is below 20% 11. Use case 2: message queue Reliable queues are a vital ingredient for buildingscalable applicationsIn Web Apps queues are used for delayed processing,load balancing, e-mail notificationsOur use case: prefetching avatars 12. Message queues: howRich Lua stored procedure environment box.fiber, box.space, box.cfgSpecialized inter-procedure communication API: box.ipcSpecialized data structures Bitmaps and partial keys 13. Use case 3: reliable databaseUser profile: 500 bytes of key/value pairsMath: 200M users * 500 = 100GBAt least 2x smaller memory footprint than in a RDBMS Win: predictable response time, significantly higherperformance 14. Example: a FIFOfunction fifo_push(name, val)fifo = find_or_create_fifo(name)top = box.unpack(i, fifo[1])bottom = box.unpack(i, fifo[2])if top == fifomax+2 then -- % sizetop = 3 endreturn box.update(0, name, =p=p=p, 1, top,2, bottom, top, val)end 15. ConclusionTarantool/Box a high performance data engine Tarantool/Lua a building block for your heavily loadedweb applicationsTarantool our approach to an easy to use databasefor highly volatile data 16. Whats cooking in 1.5Disk-based backendSynchronous master-master replicationNew data types (array, date, currency, json)authentication 17. Thank you! 18. Linkshttp://github.com/mailru/tarantool - source codehttp://github.com/mailru/tntlua - open source stored proceduresrepositoryhttp://groups.google.com/group/tarantool - mailing listhttp://tarantool.org/dist/ - always fresh .tar.gz and .rpm