SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
Multithreaded
XML Import
…for Magento

San Francisco Magento Meetup Group - October 23, 2013
Fabrizio
Branca
Lead System Developer at
E-Commerce:
Magento

CMS:
TYPO3

Global
Enterprise
Projects

Portals:
ZF, FLOW,…

High
Performance
/Scale

Mobile

Searchperience:
SOLR

120 people
in 7 offices
world-wide
Aoe_Import
github.com/AOEmedia/Aoe_Import

git clone --recursive …
Will Aoe_Import be the fastest
product importer around?

YES, of course!
Well, maybe…
Actually, Aoe_Import is only a
XML Importer “Framework”. It’s
up to you to decide how to handle
the xml snippets…
for large XML files
XML! Not CSV.

full flexibility in
processor implementation

Aoe_Import
multi-thread support!
Subscribe your
“Processors” to xpaths

Stream processing
(XMLReader)

“event” driven
memory

single product

Problem
Memory limit

time
Memory limit

time

memory

memory

Trivial Solution
Memory limit

time
Beat the memory Leak
by forking
Waiting for other
thread to terminate

Threading
overhead

Process
import
Forking?
In PHP?
$pid = pcntl_fork();
if ($pid) {
// parent process runs what is here
echo "parentn";
} else {
// child process runs what is here
echo "childn";
}
Threadi

github.com/AOEmedia/Threadi
Clean OOP interface for PHP to
forking and process management

Threadi
Batch Processor
Collect a bunch of imports …

…fork…

…and process them in
a child process.
No imports are processed in the main thread.
So there’s no memory leak happing here

Main thread
memory

Memory limit

time

Create process
collection

Waiting for other thread to terminate

Threading Process imports in process collection
overhead

Forks
Every fork starts with the low
memory footprint of the main thread

Find the number of imports
that can be processed at a
time without hitting the memory limit
Multi-threading? Sure!

Number of
threads
processed
in parallel

Number of items in a batch
Problems?
Database Connection
Database
connection
doesn’t like to
be cloned!
Mage::getSingleton('core/resource')
->getConnection('core_write')
->closeConnection();
Problems?
Thread Safety
Problems?
Thread Safety
--- a/app/code/core/Enterprise/Catalog/Model/Index/Action/Catalog/Category/Product/Refresh.php
+++ b/app/code/core/Enterprise/Catalog/Model/Index/Action/Catalog/Category/Product/Refresh.php
@@ -326,7 +326,7 @@ class Enterprise_Catalog_Model_Index_Action_Catalog_Category_Product_Refresh
->setComment('Catalog Category Product Index Tmp');
$this->_connection->dropTable($this->_getMainTmpTable());
$this->_connection->createTable($table);
$this->_connection->createTemporaryTable($table);

+
}
/**
Other Use-Cases?
Scheduler
Queue processing

Indexes

Everything
that’s batchable
Thank you!
Any questions?
My blog

http://www.aoemedia.com
http://www.fabrizio-branca.de
@fbrnc
Follow me on twitter!

Más contenido relacionado

Más de AOE

Re-inventing airport non-aeronautical revenue generation post COVID-19
Re-inventing airport non-aeronautical revenue generation post COVID-19Re-inventing airport non-aeronautical revenue generation post COVID-19
Re-inventing airport non-aeronautical revenue generation post COVID-19AOE
 
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019AOE
 
Flamingo presentation at code.talks commerce by Daniel Pötzinger
Flamingo presentation at code.talks commerce by Daniel PötzingerFlamingo presentation at code.talks commerce by Daniel Pötzinger
Flamingo presentation at code.talks commerce by Daniel PötzingerAOE
 
A bag full of trust - Christof Braun at AOE Conference 2018
A bag full of trust - Christof Braun at AOE Conference 2018A bag full of trust - Christof Braun at AOE Conference 2018
A bag full of trust - Christof Braun at AOE Conference 2018AOE
 
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...AOE
 
Frankfurt Airport Digitalization Case Study
Frankfurt Airport Digitalization Case StudyFrankfurt Airport Digitalization Case Study
Frankfurt Airport Digitalization Case StudyAOE
 
This is what has to change for Travel Retail to survive - Manuel Heidler, AOE
This is what has to change for Travel Retail to survive - Manuel Heidler, AOEThis is what has to change for Travel Retail to survive - Manuel Heidler, AOE
This is what has to change for Travel Retail to survive - Manuel Heidler, AOEAOE
 
AOEconf17: Application Security
AOEconf17: Application SecurityAOEconf17: Application Security
AOEconf17: Application SecurityAOE
 
AOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOE
 
AOEconf17: A flight through our OM³ Systems
AOEconf17: A flight through our OM³ SystemsAOEconf17: A flight through our OM³ Systems
AOEconf17: A flight through our OM³ SystemsAOE
 
AOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOE
 
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...AOE
 
AOEconf17: Agile scaling concepts
AOEconf17: Agile scaling conceptsAOEconf17: Agile scaling concepts
AOEconf17: Agile scaling conceptsAOE
 
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...AOE
 
AOEconf17: UI challenges in a microservice world
AOEconf17: UI challenges in a microservice worldAOEconf17: UI challenges in a microservice world
AOEconf17: UI challenges in a microservice worldAOE
 
AOEconf17: Application Security - Bastian Ike
AOEconf17: Application Security - Bastian IkeAOEconf17: Application Security - Bastian Ike
AOEconf17: Application Security - Bastian IkeAOE
 
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...AOE
 
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan RotschAOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan RotschAOE
 
Joern Bock: The basic concept of an agile organisation
Joern Bock: The basic concept of an agile organisationJoern Bock: The basic concept of an agile organisation
Joern Bock: The basic concept of an agile organisationAOE
 
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...AOE
 

Más de AOE (20)

Re-inventing airport non-aeronautical revenue generation post COVID-19
Re-inventing airport non-aeronautical revenue generation post COVID-19Re-inventing airport non-aeronautical revenue generation post COVID-19
Re-inventing airport non-aeronautical revenue generation post COVID-19
 
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
Flamingo - Inspiring Commerce Frontend made in Go - Meet Magento 2019
 
Flamingo presentation at code.talks commerce by Daniel Pötzinger
Flamingo presentation at code.talks commerce by Daniel PötzingerFlamingo presentation at code.talks commerce by Daniel Pötzinger
Flamingo presentation at code.talks commerce by Daniel Pötzinger
 
A bag full of trust - Christof Braun at AOE Conference 2018
A bag full of trust - Christof Braun at AOE Conference 2018A bag full of trust - Christof Braun at AOE Conference 2018
A bag full of trust - Christof Braun at AOE Conference 2018
 
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
Digitalizing the Global Travel Retail World - Kian Gould at Global Retailing ...
 
Frankfurt Airport Digitalization Case Study
Frankfurt Airport Digitalization Case StudyFrankfurt Airport Digitalization Case Study
Frankfurt Airport Digitalization Case Study
 
This is what has to change for Travel Retail to survive - Manuel Heidler, AOE
This is what has to change for Travel Retail to survive - Manuel Heidler, AOEThis is what has to change for Travel Retail to survive - Manuel Heidler, AOE
This is what has to change for Travel Retail to survive - Manuel Heidler, AOE
 
AOEconf17: Application Security
AOEconf17: Application SecurityAOEconf17: Application Security
AOEconf17: Application Security
 
AOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar Insights
 
AOEconf17: A flight through our OM³ Systems
AOEconf17: A flight through our OM³ SystemsAOEconf17: A flight through our OM³ Systems
AOEconf17: A flight through our OM³ Systems
 
AOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar InsightsAOEconf17: AOE Tech Radar Insights
AOEconf17: AOE Tech Radar Insights
 
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
AOEconf17: Pets vs. Cattle - modern Application Infrastructure - by Fabrizio ...
 
AOEconf17: Agile scaling concepts
AOEconf17: Agile scaling conceptsAOEconf17: Agile scaling concepts
AOEconf17: Agile scaling concepts
 
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
AOEcon17: Searchperience - The journey from PHP and Solr to Scala and Elastic...
 
AOEconf17: UI challenges in a microservice world
AOEconf17: UI challenges in a microservice worldAOEconf17: UI challenges in a microservice world
AOEconf17: UI challenges in a microservice world
 
AOEconf17: Application Security - Bastian Ike
AOEconf17: Application Security - Bastian IkeAOEconf17: Application Security - Bastian Ike
AOEconf17: Application Security - Bastian Ike
 
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
AOEconf17: Management 3.0 - the secret to happy, performing and motivated sel...
 
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan RotschAOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
AOEconf17: How to eat an elePHPant, congstar style - Timo Fuchs & Stefan Rotsch
 
Joern Bock: The basic concept of an agile organisation
Joern Bock: The basic concept of an agile organisationJoern Bock: The basic concept of an agile organisation
Joern Bock: The basic concept of an agile organisation
 
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
 

Último

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Multithreaded XML Import (San Francisco Magento Meetup)