Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Experience gained while building a p2p lending marketplace from scratch by Uldis Nipers from Mintos at Modern PHP 66th DevClub.lv

978 views

Published on

Topics of the talk will include: decission processes behind choosing technologies and planning architecture, the biggest techincal challanges faced, queue based architecture, quality assurance and continuous integration implementation, migration from one cloud hosting provider to other, and more.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Experience gained while building a p2p lending marketplace from scratch by Uldis Nipers from Mintos at Modern PHP 66th DevClub.lv

  1. 1. One platform. Many opportunities. Uldis Nipers software developer DevClub 18.07.2018. Experience gained while building p2p lending marketplace
  2. 2. www.mintos.com 2 Agenda ● About company ● Why PHP and why Symfony ● Planning the platform ● Safety net before launching ● Performance optimization ● Quality assurance
  3. 3. www.mintos.com 3
  4. 4. www.mintos.com 4
  5. 5. www.mintos.com 5
  6. 6. www.mintos.com 6
  7. 7. www.mintos.com 7
  8. 8. www.mintos.com 8
  9. 9. www.mintos.com 9
  10. 10. www.mintos.com 10
  11. 11. www.mintos.com 11 • Large developer pool • Affordable solutions • Extensive knowledge • Diverse selection of tools • Easy to learn • Easier to host (more providers offer hosting) • Facebook uses PHP
  12. 12. www.mintos.com 12 You can’t go wrong by choosing Symfony! And no one has ever been fired for using Symfony. • Stable environment that is both well-known and recognized internationally • Mature and permanent • Documentation and community • Interoperability
  13. 13. www.mintos.com 13
  14. 14. www.mintos.com 14
  15. 15. www.mintos.com 15
  16. 16. www.mintos.com 16 Online schema migration tools: 1. Pt-online-schema-change - https://www.percona.com/doc/percona-toolkit/LATEST/pt-online-schema-change.html 2. MYSQL Online DDL - https://dev.mysql.com/doc/refman/5.6/en/innodb-online-ddl.html 3. GitHub's online schema migration for MySQL - https://github.com/github/gh-ost
  17. 17. www.mintos.com 17
  18. 18. www.mintos.com 18 Safety first: ● Double entry bookkeeping concept ● Database auditing
  19. 19. www.mintos.com 19 Balance sheet Assets Liabilities Cash due to investorsCash in the bank Total liabilities: 0Total assets: 0 Cash account Balance: 0 Debit (+) Credit (-) 00 Client1 account Balance: 0 Debit (-) Credit (+) Client2 account Balance: 0 Debit (-) Credit (+) 1) 100 1) 100 Balance: 100 Balance: 100 100 100 Total assets: 100 Total liabilities: 100 2) 75 2) 75 Balance: 25 Balance: 25 25 Total liabilities: 25Total assets: 25 25 1) Client1 transfers money to Mintos Debit: Cash account Credit: Client1 account Amount: 100 2) Client1 withdraws money from Mintos Debit: Client1 account Credit: Cash account Amount: 75 3) Client2 transfers money to Mintos Debit: Cash account Credit: Client2 account Amount: 1300 3) 1300 3) 1300 Balance: 1300 Balance: 1375 13251325 Total assets: 1325 Total liabilities: 1325
  20. 20. www.mintos.com 20
  21. 21. www.mintos.com 21
  22. 22. www.mintos.com 22
  23. 23. www.mintos.com 23 Using ORM: P1 hydrates client's account object from DB (balance in PHP memory 100) P2 hydrates client's account object from DB (balance in PHP memory 100) P1 adds 10 to balance and updates DB (100 + 10 = 110) P2 subtracts 20 from balance and updates DB (100 - 20 = 80) Initial client account balance: 100 Scenario: P1: client gets interest payment 10 EUR (100 + 10 = 110) P2: client makes a new investment 20 EUR (110 - 20 = 90) Using native queries: P1: UPDATE account SET balance = balance + 10 WHERE id = 1; (balance 110) P2: UPDATE account SET balance = balance - 20 WHERE id = 1; (balance 90) Doctrine ORM vs native queries
  24. 24. www.mintos.com 24 ● Registering a new investment ● Making corresponding records in accounting registers ● Generating investment contract ... Investor makes investment
  25. 25. www.mintos.com 25 Investment contract job is registered Investor makes investment Queues are stored in tables Server 1 Server 2
  26. 26. www.mintos.com 26
  27. 27. www.mintos.com 27
  28. 28. www.mintos.com 28
  29. 29. www.mintos.com 29
  30. 30. www.mintos.com 30 pt-query-digest slow.log
  31. 31. www.mintos.com 31
  32. 32. www.mintos.com 32 Guide to database performance for developers: https://use-the-index-luke.com 1. pt-query-digest slow.log 2. EXPLAIN SELECT * FROM some_table WHERE col1 = “test”; 3. ANALYZE TABLE some_table;
  33. 33. www.mintos.com 33 “The bitterness of poor quality remains long after the sweetness of low price is forgotten.” Benjamin Franklin “Testing has to be an integral part of developing software and not a separate phase. When this approach is taken, product quality is owned by everyone on the team. It is easy to state, but hard to put into practice because of long-standing preconceived notions that developers and testers are better kept apart.” James Sivak
  34. 34. www.mintos.com 34 QA rules ● Code can only be merged if it is covered with automated tests ● Two reviewers ● All tests are run on every commit ● Different sorts of tests ● QA engineers ● Retrospectives
  35. 35. www.mintos.com 35 Thank you!

×