4developers 2015: skalowanie i integracja systemów w asynchronicznym stylu - szymon szylhabel,...
TRANSCRIPT
![Page 1: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/1.jpg)
©Szymon Szylhabel 4Developers 2015
Drabina Ekspertów Ścisły przewodnik po aspektach miękkich – część II
Enterprise makeover
Making sense of agile requirements
Przejrzysty i testowalny kod na Androidzie?
REST w praktyce - tej dobrej i tej złej
Skalowanie i integracja systemów w asynchronicznym stylu Do you think you're doing microservice architecture?
CQRS dla każdego
Kiedy, jak i po co migrować na NoSQL
![Page 2: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/2.jpg)
©Szymon Szylhabel 4Developers 2015
Pytanie
Ile instancji Service Bus’a wymagane jest do tego żeby zapewnić HA ?
www.bottega.com.pl facebook.com/BottegaITSolutions
![Page 3: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/3.jpg)
©Szymon Szylhabel 4Developers 2015
Dawno dawno temu ….
![Page 4: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/4.jpg)
©Szymon Szylhabel 4Developers 2015
Hurra robimy SOA
![Page 5: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/5.jpg)
©Szymon Szylhabel 4Developers 2015
Zależności
![Page 6: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/6.jpg)
©Szymon Szylhabel 4Developers 2015
Zależności
• ADP – Acyclic Dependencies Principle• Klasyfikacja komunikacji - Command, Query,
Event• Kontrola i przepływ danych
![Page 7: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/7.jpg)
©Szymon Szylhabel 4Developers 2015
„Klasyczne zalezności” zależności
CRM PDF Generator
CRM PDF Generator
Scenariusz 1
Scenariusz 2
Poll ing
Response
«flow»
Request
«flow»
Request
![Page 8: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/8.jpg)
©Szymon Szylhabel 4Developers 2015
Odwrócone zależności (Event)
CRM PDF Generator
CRM
Command
Event
Dependency
Dependency
«flow»
«flow»
![Page 9: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/9.jpg)
©Szymon Szylhabel 4Developers 2015
Orkiestracja
Sales Shipping
Warehouse Credit
Orchiestrator
![Page 10: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/10.jpg)
©Szymon Szylhabel 4Developers 2015
Sagaclass RelationshipStateMachine : AutomatonymousStateMachine<Relationship>
{
public RelationshipStateMachine()
{
Event(() => Hello);
Event(() => PissOff);
Event(() => Introduce);
State(() => Friend);
State(() => Enemy);
Initially(
When(Hello).TransitionTo(Friend),
When(PissOff).TransitionTo(Enemy),
When(Introduce)
.Then((instance,data) => instance.Name = data.Name)
.TransitionTo(Friend)
);
}
...
![Page 11: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/11.jpg)
©Szymon Szylhabel 4Developers 2015
Transakcyjność
• Transakcje rozproszone (MSDTC – two phase commit)
• Długie transakcje – blokowanie zasobów• Oddzielenie przyjęcia żądania od
przetwarzania = asynchroniczność
![Page 12: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/12.jpg)
©Szymon Szylhabel 4Developers 2015
SOA wyzwania c.d.
• Wysoka dostępność( NLB nie jest wystarczające)
• Skalowanie• Odporność na błędy przetwarzania
UI Sales
CRM
Credit
![Page 13: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/13.jpg)
©Szymon Szylhabel 4Developers 2015
Wymagania odnośnie infrastruktury
• Pub-sub• Transakcyjne zapisywanie do kolejki• Transakcyjne pobieranie z kolejki• Zapewniać HA• Pozwalać na skalowanie usług• Wspierać poprawę błędów przetwarzania•
![Page 14: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/14.jpg)
©Szymon Szylhabel 4Developers 2015
Potrzebujemy Service Busa
![Page 15: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/15.jpg)
©Szymon Szylhabel 4Developers 2015
Infrastruktura – podział
ServiceBus Message Broker
![Page 16: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/16.jpg)
©Szymon Szylhabel 4Developers 2015
Dwa lata historii (Azure) Service Bus
09-2012 10-2012 11-2012 12-2012 01-2013 02-2013 03-2013 04-2013 05-2013 06-2013
10-2013 11-2013 12-2013 01-2014 02-2014 03-2014 04-2014 05-2014 06-2014 07-2014 08-2014
SDK1.8
SDK 2.0
SDK 2.1
SB 1.0
SB 1.1
SDK 2.2
SDK 2.3
SDK 2.4
Partitions Express Entities Event Hubs
Kompatybilne z SDK 1.8 Kompatybilne z SDK 2.1
![Page 17: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/17.jpg)
©Szymon Szylhabel 4Developers 2015
Service Bus - Architektura
Windows & SQL ServerWindows & SQL Server
Service Bus VSS WriterService Bus VSS Writer
Service Bus Resource Provider
Service Bus Resource Provider
Service Bus SAS
Security & Entity Management,
Address resolution
Protocol Heads
(Rest, tcp, ampq)
Protocol Heads
(Rest, tcp, ampq)
Service Bus Gateway
.Net 4.5.Net 4.5
Windows Fabric 1.0Windows Fabric 1.0
Service Bus Message Broker
![Page 18: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/18.jpg)
©Szymon Szylhabel 4Developers 2015
Zależności
• Commands – Queues (Aktywna, Tylko odczyt, tylko zapis,
nieaktywna)
– Sessions
• Events (pub-sub) – Topics, Subscriptions
– Filtry
– Deadlettering
• Namespaces
–
![Page 19: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/19.jpg)
©Szymon Szylhabel 4Developers 2015
Zabezpieczenia• Autentykacja
– Shared Accees Key• Możliwość używania dwóch kluczy
• Działa między domenami
– Windows Integrated Security • Grupa lub użytkownik
• Active Directory
• Autoryzacja– Listen
– Send
– Manage
![Page 20: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/20.jpg)
©Szymon Szylhabel 4Developers 2015
Service Bus - Transakcyjność
• Transakcje tylko lokalne– Tylko jedna kolejka/temat/subskrypcja– Brak innych zasobów (np. SQL)
• Obsługa modelu Peek&Lock– Pobranie wiadomości i zablokowanie jej– Abandom / Defer / Complete – Lock timeout / renewal
• Detekcja duplikatów
![Page 21: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/21.jpg)
©Szymon Szylhabel 4Developers 2015
Wydajność
• Wiadomości– properties + filtry– express entities– Topiki nie zachowujące kolejności– Wiele odbiorców
• Skalowanie za darmo (sesje)• Wygładzanie peak’ów•
![Page 22: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/22.jpg)
©Szymon Szylhabel 4Developers 2015
Wydajność
![Page 23: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/23.jpg)
©Szymon Szylhabel 4Developers 2015
Wydajność
• Farma z 3 serwerów (quad CPU 2.3GHz, 24GB RAM, wiadomość 1kB )– Kolejka - 20 tyś. wiadomości na sekundę
– Temat z jedną subskrypcją (bez filtra) – 14 tyś. wiadomości na sekundę
– Temat z 1000 subskrypcji - 26 wiadomości na sekundę
•
• Pojedynczy wirtualny serwer ze słabym SQL serwerem – 40 wiadomości 1KB na sekundę
– 20 wiadomości 100KB na sekundę
– 5 wiadomości 1000KB na sekundę
•
• Laptop z i7, 8GB RAM, dysk SSD– 100 wiadomości 32kB na sekundę
•
![Page 24: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/24.jpg)
©Szymon Szylhabel 4Developers 2015
SB – Wydajność
Halo 4
![Page 25: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/25.jpg)
©Szymon Szylhabel 4Developers 2015
SB – architektura HA
![Page 26: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/26.jpg)
©Szymon Szylhabel 4Developers 2015
I żyli długo i szczęśliwie …
• Zależności - mikro świat i makro – wspólne techniki
• Transakcyjność vs SOA• Odpowiednia infrastruktura = oszczędności• Dostępność •
REST w praktyce - tej dobrej i tej złej
![Page 27: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/27.jpg)
©Szymon Szylhabel 4Developers 2015
Dziękuje
KontaktSzymon Szylhabel
•
Linki• Two phase commit - http://blog.jonathanoliver.com/how-i-avoid-two-phase-commit/
• ServiceBus 1.1 https://msdn.microsoft.com/pl-pl/library/dn282144.aspx
• Granularity (Robert C. Martin) http://www.objectmentor.com/resources/articles/granularity.pdf
• https://github.com/MassTransit/Automatonymous
• http://particular.net/nservicebus
•
![Page 28: 4Developers 2015: Skalowanie i integracja systemów w asynchronicznym stylu - Szymon Szylhabel, Bottega IT](https://reader033.vdocuments.pub/reader033/viewer/2022051314/55a65fbe1a28ab5b538b458e/html5/thumbnails/28.jpg)
©Szymon Szylhabel 4Developers 2015
Credits
• Architecture Now! 3 Jean Nouvel Photo: Copyright Jean Nouvel/Lewis Baltz Monolith (2001 - 2001) Morat, Switzerland
• http://hero.wikia.com/wiki/King_Julien
• http://www.samdutton.com/
• http://www.enterprisefeatures.com/how-does-it-benefit-from-a-move-to-the-cloud/
• https://www.flickr.com/photos/93779577@N00/15700437070
• https://msdn.microsoft.com/en-us/library/dn282144.aspx
• http://www.infoq.com/presentations/halo-4-orleans
• http://www.ebizq.net/topics/eai/features/1590.html
•
•