Pavel Prischepa. Fffast Drupal backend.
-
Upload
drupalsib -
Category
Technology
-
view
60 -
download
0
Transcript of Pavel Prischepa. Fffast Drupal backend.
![Page 1: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/1.jpg)
FFFast Drupal backend
No kidding!
Pavel Prischepa
1
![Page 2: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/2.jpg)
5 years of work with Drupal (and Drupal only) on an international level • Development • Project management • Drupal PR, promotion • Drupal audit • Consulting
Pavel Prischepa
Partner at i20 Group CEO at DrupalJedi
2
![Page 3: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/3.jpg)
Is Drupal fast?
Browser Cache layer Drupal
3
![Page 4: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/4.jpg)
Real project• 5 000 000 nodes
• 1 000 000 unique visitors per day
• 0,4 seconds per page
• Cache: MongoDB, Redis, NginX, Varnish
• Dynamic blocks: ESI, AJAX
4
![Page 5: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/5.jpg)
Drupal as backend
DrupalSingle-page application
Mobile application
Web sites
5
![Page 6: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/6.jpg)
Drupal as backend
• DRUPAL_BOOTSTRAP_FULL for each request
• 30-100 database queries per request
• Slow server response
6
![Page 7: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/7.jpg)
Silk Paints: mobile application
for drawing
7
![Page 8: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/8.jpg)
Silk Paints
• Users draw paintings, save them to server
• Backend on Drupal (Services)
• 500 000 users
• 5-20 requests per second
8
![Page 9: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/9.jpg)
9
![Page 10: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/10.jpg)
Silk Paints: launch of iOS version
• Likes
• Friend lists
• Pictures moderation
• 50-100 requests per second
10
![Page 11: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/11.jpg)
11
![Page 12: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/12.jpg)
Looking for an alternative to Drupal
• Node.js
• Python
• Zend
12
![Page 13: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/13.jpg)
One does not simply use a new framework
• Change production process
• Train / hire people
• “Nabit’ shishki”
• Meanwhile...project is uncontrollable
13
![Page 14: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/14.jpg)
Back to Drupal
14
![Page 15: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/15.jpg)
Back to Drupal• Coding standards
• Config
• DB integration
• Cache
• Modules
• Design, Develop, Testing, Deploy processes
15
![Page 16: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/16.jpg)
Запрос
Back to Drupal
Drupal
Worker
Queue Worker
WorkerQuick response
Tasks are processed in background
16
![Page 17: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/17.jpg)
Запрос
Back to Drupal
Drupal Module JS
Drush Daemon API
Drupal Queue API
Drush Daemon API
Drush Daemon API
17
![Page 18: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/18.jpg)
Silk Paints: result• 50 requests per second
• 5-10 requests to MySQL per request
• Response time less than 1 second
• Savings on development and support
• Predictability of development
18
![Page 19: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/19.jpg)
Drupal as backend Best practice
19
![Page 20: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/20.jpg)
Application architecture
• Service Oriented Architecture (SOA)
• Queue service (middleware)
20
![Page 21: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/21.jpg)
Queue service
Module 1
Drupal
Module 2
Core, Contrib modules
21
![Page 22: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/22.jpg)
Queue service
Service (based on Module 1)
Drupal Node.js Python
Drupal
Module 2Redis
as a Lock storage
Core, Contrib modules
External services
22
![Page 23: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/23.jpg)
Queue
Worker 1
Producer Worker 2
Worker 3
Work queues (worker per task)
23
![Page 24: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/24.jpg)
Queue
Subscriber 1
PublisherSubscriber 2
Subscriber 3
Publish / subscribe (one message for all subscribers)
24
![Page 25: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/25.jpg)
Queue Task
Producer
RPC
Queue Result
Worker Producer
Worker
Receive result
Create task
25
Producer Worker
![Page 26: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/26.jpg)
Best practice What else?
26
![Page 27: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/27.jpg)
Degradation of functionality
• If load increases, non-critical functionality could be disabled
• Several cases for disabling
• Approach allows pass the peak load successfully
27
![Page 28: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/28.jpg)
Cache
• Application should work perfectly without cache
• Cache invalidation scheme
• “Cold cache” problem
• Efficient of cache using (hit/miss correlation)
28
![Page 29: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/29.jpg)
Database• Take care of database
• Denormalize it!
• Check indexes
• Do not add other databases beforehand (like MongoDB)
• Migrate to Postgres? (…, NoSQL, memory storage)
29
![Page 30: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/30.jpg)
Database replica, partition, sharding
CAP Theorem:
Consistency Availability Partition tolerance
30
![Page 31: Pavel Prischepa. Fffast Drupal backend.](https://reader034.fdocuments.net/reader034/viewer/2022052700/55b643a2bb61eb2e168b4772/html5/thumbnails/31.jpg)
The most important
• The main causes of low performance - “krivie ruki”
• Use technologies that you know well
• Remember about business
• Optimize only what prevents sells
31