SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
Przetwarzanie	wsadowe	z	
wykorzystaniem	Spring	Batch
„Batch	processing	… is	defined	as	the	processing	of	data	
without	interrac-on	or	interrup-on.”	
	
Michael	Minella,	Pro	Spring	Batch
Typowe	przypadki	użycia	
—  Procesy	ETL	(Extract,	Transform	and	Load)		
—  Generowanie	raportów	
—  Analizy	statystyczne	
—  Procesowanie	transakcji	bankowych
Spring	Batch
Spring	Batch	-	cechy	
—  Zarządzenie	transakcjami	
—  Optymalizacja	operacji	odczytu,	zapisu	
—  Komponenty	realizujące	operacje	I/O	–	(flat	file,	baza	
danych)	zapewnione	przez	framework	
—  Obsługa	wyjątków	
—  Webowy	interfejs	Spring	Batch	Admin	
—  Bazuje	na	spring	framework
Architektura
Podstawowe	komponenty	
—  Job	–	zawiera	cały	proces.	Składa	się	z	jednego	bądź	kilku	
kroków	uszeregowanych	w	określonej	kolejności	
—  Step	–	każdy	z	kroków	jest	niezależny	od	pozostałych,	
reprezentuje	określony	etap	przetwarzania	wsadowego
Podstawowe	komponenty	
—  Item	-	pojedynczy	element	danych,	procesowany	w	ramach	
kroku	
—  Item	reader	–	dostarcza	dane	do	przetwarzania/zapisu	
—  Item	processor	–	przetwarza	dane	dostarczone	przez	Item	
reader	(komponent	opcjonalny)	
—  Item	writer	–	zapisuje	przetworzone	bądź	odczytane	dane
Podstawowe	komponenty	
—  Job	launcher	-	odpowiada	za	uruchamianie	joba	
—  Job	repository	-	zapewnia	operacje	CRUD	umożliwiające	
zarządzanie	aktualnym	stanem	joba	oraz	jego	
poszczególnych	kroków
Wzorzec	Reader-Processor-Writer
Wzorzec	Reader-Processor-Writer
Tasklet	Step	
—  alternatywa	dla	wzorca	Reader-Processor-Writer	
—  Konieczność	wywołania	zdalnych	usług,	skryptu	SQL	itp.
Skalowanie	oraz	przetwarzanie	
równoległe
Wielowątkowy	krok	
Step	1	
ItemReader	
ItemProcessor	
ItemWriter	
Step	2	
ItemReader	
ItemProcessor	
ItemWriter	
Step	3	
ItemReader	
ItemProcessor	
ItemWriter
Równoległe	wykonywanie	kroków	
Step	2	
ItemReader	
ItemProcessor	
ItemWriter	
Step	3	
ItemReader	
ItemProcessor	
ItemWriter	
Step	4	
ItemReader	
ItemProcessor	
ItemWriter	
Step	1	
ItemReader	
ItemProcessor	
ItemWriter
Zdalne	przetwarzanie	„porcji”	
danych	
Step	1	
ItemReader	
ItemProcessor	
ItemWriter	
Master	
ItemReader	
Chunk	
provider	
Step	3	
ItemReader	
ItemProcessor	
ItemWriter	
Slave	1	
Chunk	
processor	
ItemProcessor	
ItemWriter	
Slave	2	
Chunk	
processor	
ItemProcessor	
ItemWriter	
Slave	3	
Chunk	
processor	
ItemProcessor	
ItemWriter
Partycjonowanie	
Step	1	
ItemReader	
ItemProcessor	
ItemWriter	
Master	
Par``oner	
Step	3	
ItemReader	
ItemProcessor	
ItemWriter	
Slave	1	
ItemReader	
ItemProcessor	
ItemWriter	
Slave	2	
ItemReader	
ItemProcessor	
ItemWriter	
Slave	3	
ItemReader	
ItemProcessor	
ItemWriter
Źródła	
—  Spring	Batch	
hbp://projects.spring.io/spring-batch/	
—  Spring	Batch	on	GitHub		
hbps://github.com/spring-projects/spring-batch	
—  Spring	Batch	Admin	
hbp://docs.spring.io/spring-batch-admin/
Dziękuję	za	uwagę

Contenu connexe

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

jSession #2 - Tomasz Gimbut - Przetwarzanie wsadowe z wykorzystaniem Spring Batch

Notes de l'éditeur

  1. Przetwarzanie wsadowe polega na wykonywaniu serii zadań przez komputer. Zazwyczaj kolejne zadania są ze sobą powiązane: dane wyjściowe po zakończeniu danego etapu przekazywane są kolejnemu któremu służą jako dane wejściowe. Zadania wsadowe organizowane są w ten sposób, by ich realizacja przebiegała bez udziału użytkownika co kontrastuje z pracą programów interaktywnych, które tego wymagają. Dzięki temu przetwarzanie wsadowe posiada pewne zalety. Minimalizacja czasu bezczynności systemu dzięki pracy bez ingerencji użytkownika oraz efektywne wykorzystanie zasobów (zazwyczaj drogiego) systemu.
  2. Używany słownik pojęć
  3. Innym typem kroku jest Tasklet Step – w przypadku kiedy nie można zastosować powyższego modelu zorientowanego na przetwarzanie pojedynczych elementów (Konieczność wywołania zdalnych usług, skryptu SQL itp.)
  4. Operacje odczytu, procesowania oraz zapisu dla danej porcji danych odbywają się w oddzielnym wątku Konieczność synchronizacji operacji odczytu oraz zapisu (współdzielone obiekty ItemReader, ItemWriter mogą być obiektami stanowymi) Zawartość poszczególnych porcji danych może się różnic w stosunku do przetwarzania kroku w jednym wątku
  5. przetwarzanie w ramach danego kroku jest rozdzielone pomiędzy różne procesy komunikujące się ze sobą za pomocą warstwy pośredniczącej. Master step (single process) odczytuje dane, przesyła je do slaveów (multiple remote processes). problem z przesyłaniem znacznych ilości danych do/z slaveów możliwość bezczynności slave’ów procesowanie powinno być bardziej kosztowne niż odczyt danych
  6. Partitioning a Step (single or multi process) do zrealizowania w ramach jednego procesu (każdy krok w ramach innego wątku) bądź rozdzielenie przetwarzania pomiędzy różne procesy Framework tworzy identyczne kopie kroków (każdy zawierający oddzielną instancję reader procesor oraz wiriter) operujących na ściśle określonych zbiorach danych. Elementy przeznaczone do procesowania są dzielone na określone partycje i przypisywane do określonym krokom do wykonania Brak problemu wyścigów brak wąskich gardeł wynikających z potrzeby synchronizacji operacji ItemReader oraz Item Writer Mechanizm określający jak podzielić dane może być złożony Konieczność oczekiwania aż ostatni ze slave’ów zakończy działanie. (potencjalnie gorszy load balancing) Konieczność efektywnego podzielenia danych pomiędzy slave’y