Orchestrating Microservices Using LlamaIndex Workflows

LlamaIndex · Intermediate ·🏗️ Systems Design & Architecture ·8mo ago

Key Takeaways

The video demonstrates how to use LlamaIndex Workflows to orchestrate microservices in an e-commerce system, leveraging Docker, Apache Kafka, and event-driven communication to manage payments, orders, and stock updates.

Full Transcript

Hi everyone, Cleia here from Llama Index and today we're going to talk about how to use Lama index workflows with microservices. As we know microservices are a specific type of architecture which instead of having uh all the services and all the dependencies of your application in one big monolith. break down that monolith into single containerized services that are able to um that are able to do a very specific job. For example, in um e-commerce um you know e-commerce environment which is the uh example that we're going to that we're going to dive into today with llama index workflows. Um, we have a micros service that for example handles the front end and and the authentication. Uh, one that handles payments, one that handles orders and one for example that updates the stock meaning the available items that we have in our stock. So in order to um follow up in order to follow with this demo um I uh advise you to look for this uh GitHub repository which will be uh which we'll be looking into uh today like following along with the following along with the readme. So as you can see uh this is a docker based uh this is a docker based I would say demo uh in the quick start you just need to uh clone the repository and just run docker compose app minusd and go to localhost 8000 and as you can see here we have an explanation of how the application is structured as I as I was saying earlier we have a front end and authentication payment processing orders, stock management and then we have posris, CFKA and so keeper as you can see posris is basically the database that keeps track of payments orders and stock and cafka instead is the event-driven communication between microservices streaming orders to the payments order and stock processing services and getting back the status of the processing operations and zookeeper and zookeeper is basically just doing cafka management uh we're not super interested in the stock of front end authentication which is basically a go web server but what we're interesting in is how we're handling workflows how we're using workflows to handle uh handle the processing basically because we're using workflows for payments orders and managing our stock and how are we using this workflows so we detect first of all we detect an event in CFKA this event triggers the start of a workflow and the first step of a workflow is basically data processing sync. So we take the data, we take the row data of the event which is passed in as row JSON data and we extract the structure data order, payment, stock, item, whatever it is. And so after that what we do is we take the structure data and we build a query with the structured data to update a database being it inserting an order or a payment or updating the available number of a specific stock item. After that we end the workflow and the workflow will restitute the status of the operation. So the operation succeeded the operation did not succeed and we send this operation details back to Kafka. So as you can see here we have as we said front end that sense the order as JSON data the payments the order and the stalker subscribed all to one Kafka topic which is orders each of which of this uh services through a workflow the workflow that we just detailed sends a payment creates an order update yeah the stock of the an item in the stock and once they're done they produce uh a they produce success detail operation like an operation detail with the type of the operation for example payment the success false true like it's successful or not and the ID of the order that we processed and each of these operation types operation statuses get basically written to one partition per service. So the payments right to the partition zero, the status right to partition one and the for sorry the orders right to partition one and the stop rights to partition two. All of this operation status get streamed back to the front end which will tell us uh since there might be some as as we know like on small scale services there might be some disturbances there might be some errors and it will tell us what went good what went well and what did not. Okay. So we can run this docker compose app minus d. So this is obvious this will obviously uh kick off uh pulling images like cafka poseper if you don't have them already installed and it will kick off the build of spec of the specific images for the services that we have the main service and all the other services because they are build based and not image based but with me I already did that so it won't pull the images it will directly start the containers so as you can see Here it started containers. Everything should be working fine. As you can see here, all my containers are up. All my services are up and running. So I can now go to localhost localhost 8000. I am not I am not I would say uh logged in. So I would go to register and create a user. So now just to have it in mind. So my username, my password and I will sign in. That's great. Now we have different things we can do. We can buy. As you can see this is very a very simple demo. So we are going to use Monopoly dollars and we are going to buy our cozy socks. and what I do now is that I place my order. All of these uh details when I place my order will be processed through this pipeline. Okay, so order ID amount will go through each of the workflows. uh obviously in parallel. So since we have Kafka, each of these is triggered each of the workflows is triggered when one order is published on the orders topic. So these workflows run in parallel. So they're not sequential. They publish the data to the POSSQL database and they publish the status of their operation status to each of the partitions of the Kafka topic or status which will read read back which will be read back by the front end. And now as we can see we had uh failures we had failed failures in updating uh the order failure in placing the order failure in the payment and failure in updating the stock. This might happen because obviously this is like as I said mocks a um a small scale e-commerce shop. So there might be disturbances in the uh communication and and and stuff like this. But it might happen also that you have everything green and so you will have basically everything gets and that's almost that's basically everything. If you have uh if you want to try this out you can just uh go to github.com/astrobbert/workloss microservices and you can clone this repository and just run it with docker and you can also take a better look at the code. So, thank you all for following along and hope to see you in the next video.

Original Description

What if you could orchestrate your entire microservices setup using LlamaIndex Workflows? In this demo, Clelia shows how to spin up and connect an event-driven e-commerce system powered by LlamaIndex Workflows, Docker, and Apache Kafka with minimal overhead. 🖥️ Try it yourself: https://github.com/AstraBert/workflows-microservices 📚 Learn more: https://developers.llamaindex.ai/python/workflows/?utm_source=youtube&utm_medium=li_channel #LlamaIndex #Microservices #Kafka #Docker
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LlamaIndex · LlamaIndex · 0 of 60

← Previous Next →
1 LlamaIndex Virtual Meetup (May 4th, 2023)
LlamaIndex Virtual Meetup (May 4th, 2023)
LlamaIndex
2 LlamaIndex + MongoDB Workshop/Fireside Chat
LlamaIndex + MongoDB Workshop/Fireside Chat
LlamaIndex
3 Discover LlamaIndex: Ask Complex Queries over Multiple Documents
Discover LlamaIndex: Ask Complex Queries over Multiple Documents
LlamaIndex
4 Discover LlamaIndex: Document Management
Discover LlamaIndex: Document Management
LlamaIndex
5 Discover LlamaIndex: Joint Text to SQL and Semantic Search
Discover LlamaIndex: Joint Text to SQL and Semantic Search
LlamaIndex
6 Discover LlamaIndex: JSON Query Engine
Discover LlamaIndex: JSON Query Engine
LlamaIndex
7 LlamaIndex Webinar: Active Retrieval Augmented Generation
LlamaIndex Webinar: Active Retrieval Augmented Generation
LlamaIndex
8 LlamaIndex Webinar: Demonstrate-Search-Predict (DSP) with Omar Khattab
LlamaIndex Webinar: Demonstrate-Search-Predict (DSP) with Omar Khattab
LlamaIndex
9 LlamaIndex Sessions: Practical challenges of building a Legal Chatbot over your PDFs
LlamaIndex Sessions: Practical challenges of building a Legal Chatbot over your PDFs
LlamaIndex
10 LlamaIndex Webinar: Graph Databases, Knowledge Graphs, and RAG with Wey (NebulaGraph)
LlamaIndex Webinar: Graph Databases, Knowledge Graphs, and RAG with Wey (NebulaGraph)
LlamaIndex
11 LlamaIndex Webinar: Community Project Showcase (07/07/2023)
LlamaIndex Webinar: Community Project Showcase (07/07/2023)
LlamaIndex
12 LlamaIndex Webinar: LLMs for Investment Research (with Didier Lopes, co-founder/CEO at OpenBB)
LlamaIndex Webinar: LLMs for Investment Research (with Didier Lopes, co-founder/CEO at OpenBB)
LlamaIndex
13 Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 1, LLMs and Prompts)
Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 1, LLMs and Prompts)
LlamaIndex
14 Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 2, Documents and Metadata)
Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 2, Documents and Metadata)
LlamaIndex
15 Discover LlamaIndex: Key Components to build QA Systems
Discover LlamaIndex: Key Components to build QA Systems
LlamaIndex
16 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 3, Evaluation)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 3, Evaluation)
LlamaIndex
17 LlamaIndex Webinar: From Prompt to Schema Engineering with Pydantic  (with @jxnlco)
LlamaIndex Webinar: From Prompt to Schema Engineering with Pydantic (with @jxnlco)
LlamaIndex
18 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 4, Embeddings)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 4, Embeddings)
LlamaIndex
19 Discover LlamaIndex: Custom Retrievers + Hybrid Search
Discover LlamaIndex: Custom Retrievers + Hybrid Search
LlamaIndex
20 LlamaIndex Webinar: Document Metadata and Local Models for Better, Faster Retrieval
LlamaIndex Webinar: Document Metadata and Local Models for Better, Faster Retrieval
LlamaIndex
21 LlamaIndex Webinar: Build Personalized AI Characters with RealChar
LlamaIndex Webinar: Build Personalized AI Characters with RealChar
LlamaIndex
22 LlamaIndex Webinar: Make RAG Production-Ready
LlamaIndex Webinar: Make RAG Production-Ready
LlamaIndex
23 LlamaIndex Workshop: Building RAG with Knowledge Graphs
LlamaIndex Workshop: Building RAG with Knowledge Graphs
LlamaIndex
24 Discover LlamaIndex: Introduction to Data Agents for Developers
Discover LlamaIndex: Introduction to Data Agents for Developers
LlamaIndex
25 LlamaIndex Webinar: Finetuning + RAG
LlamaIndex Webinar: Finetuning + RAG
LlamaIndex
26 Discover LlamaIndex: SEC Insights, End-to-End Guide
Discover LlamaIndex: SEC Insights, End-to-End Guide
LlamaIndex
27 Discover LlamaIndex: Custom Tools for Data Agents
Discover LlamaIndex: Custom Tools for Data Agents
LlamaIndex
28 LlamaIndex Sessions: Building a Lending Criteria Chatbot in Production
LlamaIndex Sessions: Building a Lending Criteria Chatbot in Production
LlamaIndex
29 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 5, Retrievers + Node Postprocessors)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 5, Retrievers + Node Postprocessors)
LlamaIndex
30 LlamaIndex Webinar: How to Win a LLM Hackathon
LlamaIndex Webinar: How to Win a LLM Hackathon
LlamaIndex
31 LlamaIndex Webinar: LLM Challenges in Production (w/ Mayo Oshin, AI Jason, Dylan from Starmorph)
LlamaIndex Webinar: LLM Challenges in Production (w/ Mayo Oshin, AI Jason, Dylan from Starmorph)
LlamaIndex
32 LlamaIndex Webinar: Agents Showcase!
LlamaIndex Webinar: Agents Showcase!
LlamaIndex
33 LlamaIndex Webinar: Learn about DSPy
LlamaIndex Webinar: Learn about DSPy
LlamaIndex
34 LlamaIndex Webinar: Time-based retrieval for RAG (with Timescale)
LlamaIndex Webinar: Time-based retrieval for RAG (with Timescale)
LlamaIndex
35 LlamaIndex Webinar: Build/Break/Test LLM Apps Showcase (co-hosted with TrueEra, Pinecone)
LlamaIndex Webinar: Build/Break/Test LLM Apps Showcase (co-hosted with TrueEra, Pinecone)
LlamaIndex
36 LlamaIndex Workshop: Evaluation-Driven Development (EDD)
LlamaIndex Workshop: Evaluation-Driven Development (EDD)
LlamaIndex
37 LlamaIndex Webinar: Building LLM Apps for Production, Part 1 (co-hosted with Anyscale)
LlamaIndex Webinar: Building LLM Apps for Production, Part 1 (co-hosted with Anyscale)
LlamaIndex
38 LlamaIndex Webinar: Learn about Fine-tuning + RAG (w/ Victoria Lin, author of RA-DIT)
LlamaIndex Webinar: Learn about Fine-tuning + RAG (w/ Victoria Lin, author of RA-DIT)
LlamaIndex
39 LlamaIndex Webinar: What's next for AI after OpenAI Dev Day?
LlamaIndex Webinar: What's next for AI after OpenAI Dev Day?
LlamaIndex
40 Introducing create-llama
Introducing create-llama
LlamaIndex
41 LlamaIndex Webinar: PrivateGPT - Production RAG with Local Models
LlamaIndex Webinar: PrivateGPT - Production RAG with Local Models
LlamaIndex
42 Multi-modal Retrieval Augmented Generation with LlamaIndex
Multi-modal Retrieval Augmented Generation with LlamaIndex
LlamaIndex
43 LlamaIndex Webinar: LLaVa Deep Dive
LlamaIndex Webinar: LLaVa Deep Dive
LlamaIndex
44 A deep dive into Retrieval-Augmented Generation with Llamaindex
A deep dive into Retrieval-Augmented Generation with Llamaindex
LlamaIndex
45 LlamaIndex Workshop: Multimodal + Advanced RAG Workhop with Gemini
LlamaIndex Workshop: Multimodal + Advanced RAG Workhop with Gemini
LlamaIndex
46 LlamaIndex Webinar: Efficient Parallel Function Calling Agents with LLMCompiler
LlamaIndex Webinar: Efficient Parallel Function Calling Agents with LLMCompiler
LlamaIndex
47 Introduction to Query Pipelines (Building Advanced RAG, Part 1)
Introduction to Query Pipelines (Building Advanced RAG, Part 1)
LlamaIndex
48 LLMs for Advanced Question-Answering over Tabular/CSV/SQL Data (Building Advanced RAG, Part 2)
LLMs for Advanced Question-Answering over Tabular/CSV/SQL Data (Building Advanced RAG, Part 2)
LlamaIndex
49 LlamaIndex Webinar: Advanced Tabular Data Understanding with LLMs
LlamaIndex Webinar: Advanced Tabular Data Understanding with LLMs
LlamaIndex
50 Ollama X LlamaIndex Multi-Modal
Ollama X LlamaIndex Multi-Modal
LlamaIndex
51 Build Agents from Scratch (Building Advanced RAG, Part 3)
Build Agents from Scratch (Building Advanced RAG, Part 3)
LlamaIndex
52 LlamaIndex Webinar: Build No-Code RAG with Flowise
LlamaIndex Webinar: Build No-Code RAG with Flowise
LlamaIndex
53 LlamaIndex Sessions: Practical Tips and Tricks for Productionizing RAG (feat. Sisil @ Jasper)
LlamaIndex Sessions: Practical Tips and Tricks for Productionizing RAG (feat. Sisil @ Jasper)
LlamaIndex
54 Introduction to LlamaIndex v0.10
Introduction to LlamaIndex v0.10
LlamaIndex
55 Build SELF-DISCOVER from Scratch with LlamaIndex
Build SELF-DISCOVER from Scratch with LlamaIndex
LlamaIndex
56 Introducing LlamaCloud (and LlamaParse)
Introducing LlamaCloud (and LlamaParse)
LlamaIndex
57 LlamaIndex Sessions: 12 RAG Pain Points and Solutions
LlamaIndex Sessions: 12 RAG Pain Points and Solutions
LlamaIndex
58 LlamaIndex Webinar: RAG Beyond Basic Chatbots
LlamaIndex Webinar: RAG Beyond Basic Chatbots
LlamaIndex
59 A Comprehensive Cookbook for Claude 3
A Comprehensive Cookbook for Claude 3
LlamaIndex
60 LlamaIndex Webinar: RAPTOR - Tree-Structured Indexing and Retrieval
LlamaIndex Webinar: RAPTOR - Tree-Structured Indexing and Retrieval
LlamaIndex

The video demonstrates how to use LlamaIndex Workflows to orchestrate microservices in an e-commerce system, showcasing the benefits of event-driven communication and workflow management. By following along, viewers can learn how to design and implement microservices architecture, deploy Docker containers, and configure Apache Kafka for event-driven communication.

Key Takeaways
  1. Clone the GitHub repository
  2. Run docker compose app to start the containers
  3. Access the e-commerce system at localhost:8000
  4. Register and create a user
  5. Place an order to trigger the workflows
  6. Observe the workflow execution and status updates
💡 Using LlamaIndex Workflows to orchestrate microservices enables efficient and scalable management of complex e-commerce systems, allowing for real-time updates and notifications.

Related AI Lessons

Up next
Retracing It All With My Son
Ginny Clarke
Watch →