Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

1,565 views

Published on

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

Published in: Software
  • Be the first to comment

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

×