Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Sterowniki .NET i C++ dla Apache Cassandra
1. Sterowniki .NET i C++ dla
Apache Cassandra
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
2. dr inż. Paweł Kapłański
Cognitum
p.kaplanski@cognitum.eu
3. Cognitum
Autoryzowany dystrybutor DataStax Enterprise w Polsce
Dostarczamy:
Big Data
Cloud
Wysoce skalowalne aplikacje w chmurze
Rozwiązania Big Data
Systemy zarządzania wiedzą
Aplikacje dedykowane
Rozwój oprogramowania i testowanie aplikacji
Konsulting IT
Semantics
strong partnerships:
Customers from: US, CH, FL, DE
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
4. Spis treści (Agenda)
1.
2.
3.
4.
5.
6.
7.
Cassandra
Jak działają stare sterowniki oparte o Thrift
Asynchroniczność
Binarny protokół klient-serwer w Cassandrze
Przykład (driver .Net)
Plany na przyszłość
Driver C++
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
5. Cassandra
1. noSql – BigTable (Google 2005)
2. Stworzona w FB – obecnie Apache
3. Rozproszona
4. Skalowalna - Duże (100PB) dane
5. Obecnie już istnieją instalacje po 1000 nodów
6. Symetryczna (odporna na awarie)
7. Klaster (możliwość instalacji „multidatacenter”)
8. Elastyczna – duże możliwości konfiguracji
9. CQL – Cassandra Query Language
– podobny do SQL
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
6. Multidatacenter
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
7. Typowa aplikacja (serwis www .Net)
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
8. Ważne!
1. Driver to nie tyko „smart socket” - posiada
rozbudowaną logikę działania
2. Driver zarządza połączeniami do klastra
– load balancer
3. Użytkownik nie musi martwić się o
połączenie i strategię – wystarczy ze użyje
jednej z dostaraczanych np. RoundRobin
4. Driver potrafi automatycznie powtórzyć
zapytanie w razie potrzeby
5. Można tworzyć własne strategie
6. Lock-free (wysoka wydajność)
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
9. Interfejsy C*: Thrift
1. IDL (interface definition language)
2. Pozwala na automatyczne generowanie
kodu w różnych językach
3. Sam Thrift to nie wszystko – trzeba
obsłużyć zapytania do klastra
4. Zapytanie blokuje połączenie
(podobnie jak zapytanie http)
w oczekiwaniu na odpowiedź
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
10. Interfejsy C*: Protokół binarny
1.
Operacje asynchroniczne
2.
Pojedyncze polaczenie do 128
jednoczesnych zapytan
3.
Lepsze wykorzystanie zasobów (połączenia
są kosztowne)
4.
Cassandra może lepiej optymizować
5.
Wsparcie dla programowania
asynchronicznego – powszechne obecnie w
podejsciu client-server
6.
Zdarzenia z Cassandy są „pushowane”
•
zmiana schematu bazy
•
zmiana w topologii klastra
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
11. Wspierane języki
1.
Native Protocol Drivers (Datastax)
•
Java driver (with ORM)
•
.Net driver (Cql2Linq, ORM)
•
Python
•
C++ Driver – early stage of development
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
12. Przykład – połączenie (driver .Net)
1. public class NerdMovie {
[PartitionKey] public string Movie;
[ClusteringKey(1)] public string Director;
public string MainActor;
public int Year;
}
2. var cluster = Cluster.Builder().AddContactPoints("192.168.13.1", "192.168.13.1").Build();
3. using (var session = cluster.Connect("test")){
var nerdMovieTable = session.GetTable<NerdMovie>();
nerdMovieTable.CreateIfNotExists();
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
13. Zapytania
var batch = session.CreateBatch();
batch.Append(nerdMovieTable.Insert(
new NerdMovie() { Movie = "Serenity", Director = "Joss Whedon", MainActor = "Nathan Fillion", Year = 2005 }));
batch.Append(nerdMovieTable.Insert(
new NerdMovie() { Movie = "Pulp Fiction", Director = "Quentin Tarantino", MainActor = "John Travolta", Year
= 1994 }));
batch.Append(nerdMovieTable.Insert(
new NerdMovie() { Movie = "Zero Charisma", Director = "Katie Graham", MainActor = "Nathan Fillion", Year = 2013
}));
var query = from m in nerdMovieTable select m;
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
14. Wywołanie synchroniczne
batch.Execute();
var result = query.Execute();
foreach (var e in result)
Console.WriteLine("Movie " + e.Movie + "[" + e.Director + "]");
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
15. Wywołanie asynchroniczne
ManualResetEventSlim ev = new ManualResetEventSlim();
batch.BeginExecute((ar1) => {
batch.EndExecute(ar1);
query.BeginExecute((ar2) => {
var result = query.EndExecute(ar2);
foreach (var e in result)
Console.WriteLine("Movie " + e.Movie + "[" + e.Director + "]");
ev.Set();
}, null);
}, null);
ev.Wait();
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
16. Co dalej? (driver .Net)
Protokół binarny: wersja 2 (Cassandra 2.x)
-
Batch
-
Autentykacja poprzez SASL
-
Lekkie transakcje – implementacja protokołu
Paxos
IINSER … IF NOT EXISTS,
UPDATE … IF <column>=<value>
-
Strumieniowanie wyników
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
17. Driver C++ (w drodze)
1. Wieloplatformowość (np. embedded)
2. Oparty o boost::asio
3. Mała liczba zależności od innych
bibliotek
www.cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.
18. Kontakt
Cognitum | PL, Warszawa
office@cognitum.eu
+48 22 250 2541
www.cognitum.eu/semantics
abroad sales representatives:
Cognitum | CH, St. Gallen
swiss-office@cognitum.eu
www.cognitum.eu
Cognitum | UK, Bristol
uk-office@cognitum.eu
The company, product and service names used in this web site are for identification purposes only.
All trademarks and registered trademarks are the property of their respective owners.