Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Transactional vs. Analytical Processing

Transactional vs. Analytical Processing

This talk was given at SymfonyCon Disneyland Paris 2022.

When it comes to the design of your Symfony application, data plays a central role. From an architectural point of view there are two common ways this data is processed. Transactional processing ensures that changes to your data are consistent and safe. Analytical processing aims to make even complex queries fast and efficient.
We should always consider the nature of processing while implementing our application’s use cases. So let's have a look at the main criterias, strategies and trade offs that will help us to navigate through all the options we have and see how we can bring your own data warehouse to life in your Symfony application leveraging tools like Doctrine, Messenger and more.

Christopher Hertel

November 17, 2022
Tweet

More Decks by Christopher Hertel

Other Decks in Technology

Transcript

  1. 2

  2. Depends on what? 5 People & Skills Infrastructure Current System

    Time & Budget Requirements • What kind of data? • What is the use-case?
  3. Today’s Questions • What types of data are there? •

    How do we interact with data? • Why bother at all? And when? 6
  4. • Telegram Bot “SymfonyConBot” • Features • Access SymfonyCon’s schedule

    • Lookup current and next talks • Search for talks and speakers • Confirm attendance of a talk • Rate a talk • Build with Symfony 9 Example Application
  5. 12 Example Application live.symfony.com Telegram App User • Id •

    First name • Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User
  6. 14 Example Application live.symfony.com Telegram App User • Id •

    First name • Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User
  7. 15 Qualitative Data User • Id • First name •

    Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User Nominal Data • Names/Labels • Not ordered • Potentially static Ordinal Data • Ordered • Sequence • No arithmetics • Not numeric • Not measurable • Categorical data • Content Qualitative
  8. 16 Quantitative Data User • Id • First name •

    Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User Discrete Data • Only integers • Limited • No subdivision • Quantified • Numeric • Measurable • Process Artifacts Quantitative Continuous Data • Processing • Any numeric value • Unlimited Average Rating of Talk
  9. Quantitative • Quantified • Numeric • Measurable • Process Artifacts

    Discrete Data • Only integers • Limited • No subdivision Continuous Data • Processing • Any numeric value • Unlimited Qualitative • Not numeric • Not measurable • Categorical data • Content Nominal Data • Names/Labels • Not ordered • Potentially static Ordinal Data • Ordered • Sequence • No arithmetics Types of Data 17
  10. 18 Example Application live.symfony.com Telegram App User • Id •

    First name • Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User
  11. 21 Dimensions Interaction Conference User Conference • Basis of business

    process • Descriptive data • Horizontal tables • Larger share in schema • Initial structure Dimension Tables
  12. 22 Facts Interaction Conference User Interaction • Outcome of business

    process • Numbers & foreign keys • Vertical tables • Less often than dimensions • Comes after dimensions Fact Tables
  13. Dimension Tables • Basis of business process • Descriptive data

    • Horizontal tables • Larger share in schema • Initial structure Slots & Talks Dimensions vs. Facts 23 Fact Tables • Outcome of business process • Numbers & foreign keys • Vertical tables • Less often than dimensions • Comes after dimensions Attendance & Ratings
  14. 24 Example Application live.symfony.com Telegram App User • Id •

    First name • Last name Talk • Title • Speaker • Description • Slot • Track Slot • Start date • End date Track • Name Rating • Talk • User • Stars Attendance • Talk • User
  15. Transactional Processing[OLTP] • Focus on transaction • Operative systems •

    Validation and consistency • CRUD on single records • Real time • Well defined 31 Table
  16. Analytical Processing[OLAP] • Focus on analysis • Reporting systems •

    Filtering and reducing • Across multiple records • Periodically • Variable 32 Table
  17. 34 Schedule Management Interaction Conference User • Read & write

    • Relational data • Validity & consistency • No metrics nor analysis • Real time
  18. 36 Schedule Search Interaction Conference User • Only read •

    Nominal data • Fuzzy • Delay is okay Index
  19. 37 Attending & Rating a talk Interaction Conference User •

    Append only • Facts • Discrete data • Real time
  20. 38 Conference Analysis Interaction Conference User • Read only •

    Calculations • Filtering • Delay is okay Views
  21. Common pitfalls 40 • Monolithic persistence => Everything in the

    same tables • Missing isolation => Which classes write in this table? • Performance issues => Mixing engine & user land logic Maintaining, Slicing & Scaling Systems
  22. 44 Flow of Data OLTP OLAP Database INSERT INTO …

    SELECT X FROM … Database Worker
  23. 46 Flow of Data Conference OLTP WRITE OLAP READ Index

    Interaction View OLTP WRITE OLAP READ EventBus
  24. 48 Example Decisions OLTP OLAP QUALITATIVE QUANTITATIVE ELASTICSEARCH INFLUXDB MEILISEARCH

    REDIS CLICKHOUSE SUPERSET MONGO DB POSGRESQL MYSQL SQLITE
  25. The Takeaways • Consider the data structure & role in

    business processes early on • Focus on data processing while choosing persistence engine • Don’t always use MySQL, sane start though • Decouple data like you do with software components & services • Don’t avoid redundancy by all means • Consider the flow of data, evaluate on change & don’t act too early 50
  26. 53

  27. Redis CLI Application How is that solved? 55 Web Application

    Packagist Database PERIODICAL AGGREGATION OLTP WRITE OLAP READ
  28. Further Reading • SymfonyCon Bot Source code on GitHub github.com/chr-hertel/symfonycon-bot

    • 6 Types of Data in Statistics & Research: Key in Data Science By Silvia Valcheva www.intellspot.com/data-types/ • SQL vs. NoSQL Database: When to Use, How to Choose By Satish Chandra Gupta www.ml4devs.com/articles/datastore-choices-sql-vs-nosql-database/ • Difference between Fact Table and Dimension Table By MKS075 www.geeksforgeeks.org/difference-between-fact-table-and-dimension-table/ • Emerging Architectures for Modern Data Infrastructure By Bornstein, Li & Casado future.com/emerging-architectures-modern-data-infrastructure/ 58