Successfully reported this slideshow.
Your SlideShare is downloading. ×

Cassandra Summit EU 2014 Lightning talk - Paging (no animation)

Loading in …3
×

Check these out next

1 of 16 Ad
1 of 16 Ad
Advertisement

More Related Content

Similar to Cassandra Summit EU 2014 Lightning talk - Paging (no animation) (20)

Advertisement
Advertisement

Cassandra Summit EU 2014 Lightning talk - Paging (no animation)

  1. 1. I want my data out: streaming + observable + paging Christopher Batey @chbatey ©2013 DataStax Confidential. Do not distribute without consent. 1
  2. 2. Who am I? •Technical Evangelist for Apache Cassandra • Founder of Stubbed Cassandra • Help out Apache Cassandra users • Previous: Senior software engineer @ BSkyB
  3. 3. Cassandra is great because… • What was once hard is now easy! • More and more features that aren’t part of its core competency
  4. 4. Your favourite - OutOfMemory Application C Big Query
  5. 5. Your favourite - OutOfMemory Application C Big Query
  6. 6. Your favourite - OutOfMemory Uh oh, OutOfMemory Application C Big Query
  7. 7. Your favourite - OutOfMemory Uh oh, OutOfMemory Application C Big Query
  8. 8. Okay so 2 gb queries aren’t recommended?
  9. 9. Manual paging WEB Your Application DAO Lots of small queries Super C* Blocking Queue
  10. 10. Server side paging = awesome
  11. 11. Your favourite - OutOfMemory Uh oh, OutOfMemory Application C Big Query
  12. 12. Not so manual paging Your Application Super awesome paging query! C*
  13. 13. ResultSet + Observable = Awesome public Observable<CustomerEvent> getCustomerEventsObservable(String customerId) { BoundStatement boundStatement = getEventsForCustomer.bind(customerId); ListenableFuture<ResultSet> resultSetFuture = session.executeAsync(boundStatement); Observable<ResultSet> observable = Observable.from(resultSetFuture, Schedulers.io()); Observable<Row> rowObservable = observable.flatMapIterable(result -> result); return rowObservable.map(row -> new CustomerEvent( row.getString("customer_id"), row.getUUID("time"), row.getString("staff_id"), row.getString("store_type"), row.getString("event_type"), row.getMap("tags", String.class, String.class))); } p
  14. 14. ResultSet + Observable = Awesome Observable<CustomerEvent> chbatey = customerEventDao.getCustomerEventsObservable("chbatey"); chbatey.doOnCompleted(() -> { try { outputStream.close(); } catch (IOException e) { } }); chbatey.subscribe(event -> { try { outputStream.write(event.serialise()); } catch (IOException e) { } });
  15. 15. Manual paging WEB Your Application DAO Lots of small queries Super C* Blocking Queue
  16. 16. Thanks for listening @chbatey http://christopher-batey.blogspot.co.uk

×