Guest User

Untitled

a guest
Nov 19th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. Equality clause on columns, for example: (C1 == “US”)
  2. Conjunctions of such clauses, example:
  3. (C1 == “IN”) && (C2 == “home.php”)
  4. (C1 == “IN”) && (C2 == “search.php”) && (C3 == “nytimes.com”)
  5.  
  6. When the system boots, all the subscribers register their predicates to the dispatcher
  7. After this events start coming to the dispatcher
  8. For each event, the dispatcher has to emit the id of the matching subscribers.
  9.  
  10. Class Dispatcher {
  11.  
  12. public Dispatcher(int N /* number of columns in each event – fixed up front */);
  13.  
  14. public void registerSubscriber( String subscriberId /* assume no conflicts */,
  15. String predicate /* predicate for this subscriberid */);
  16.  
  17. public List<String> findMatchingIds(String[] event /* assume each event has N Strings */);
  18.  
  19. }
  20.  
  21. (N, K) -> set of subscribers who specified K in field N
  22. (N, "") -> set of subscribers who omitted a predicate for field N
  23.  
  24. (N, K) -> unique token T (small integer)
  25.  
  26. (1, "IN") -> 1
  27. (2, "home.php") -> 2
  28. (2, "search.php") -> 3
  29. (3, "nytimes.com") -> 4
  30.  
  31. o --1--> o --2--> o --0--> o --0--> o
  32.  
  33. -3--> o --4--> o --0--> o
  34.  
  35. a)The logical model here is table with columns of strings (C1..CN), and each new row added is a new event.
  36. b)We could have A hash-table per column storing a tupple of (timestamp, pointer to event structure). And each event is given a unique id. With different data-structures,we can come up with different schemes.
  37. c) Events here are considered as infinite stream. If we have a 32-bit eventId, we have chances of integer-overflow.
  38. d) If we have a timer function on the server, matching and dispatching events,what is the actual resolution of the system timer? Does that have any implication?
  39. e) Memory allocation is a very expensive operation. If your filter-matching logic is going to do frequent allocations/ freeing, it will adversely affect performance. How can we manage the memory-pool for this particular operation? Would we different size-buckets of page-aligned memory?
Add Comment
Please, Sign In to add comment