SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
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!

Mais conteúdo relacionado

Mais 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
 

Mais 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

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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 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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Multithreaded XML Import (San Francisco Magento Meetup)