Practices in using Swoole ecosystem & migration real production marketplace app to async approach. Which benefits we got and what problems happens on stack with PHP8, Postgresql, Redis, RebbitMQ, Doctrine, coroutines/fibers, concurrency HTTP Server.
Go 語言 (又稱Golang) 是 Google 推出新一代的強大語言,今年 3 月 Google 公佈了去年底統計的問卷結果,發現 63% 用 Go 來寫網站,38% 用來開發系統程式,35% 用來做 DevOps,本次議題將會帶您瞭解為什麼 Go 語言適合打造微服務架構,Go 語言大給微服務什麼樣的特性以及 Go 語言適合用來開發什麼樣的系統?
Jenkins to Gitlab - Intelligent Build-PipelinesChristian Münch
At netz98 we moved from Jenkins to Gitlab. The slides show some insides about Testing of PHP libraries, Magento 1 and Magento 2 modules. How to setup a scalable and fast Gitlab-Pipeline with Docker images.
Formation JPA Avancé / Hibernate gratuite par Ippon 2014Ippon
Les ORM, c’est pratique. Mais cela peut rapidement devenir complexe ou subtile. JPA permet de rapidement modéliser la couche d’accès aux données avec une facilité indiscutable. Cependant, il est préférable de bien en comprendre le fonctionnement pour éviter quelques anti patterns fâcheux.
La formation JPA Avancé proposée par Ippon détaille les aspects techniques et permet d’aller plus loin dans la compréhension et la maîtrise. Enrichie par des TP très fournis lorsqu’elle est dispensée par les formateurs Ippon, elle permet d’assimiler en 3 jours les subtilités et offre les outils pour réaliser une couche d’accès aux données de qualité, performante et maintenable.
Techniques de modélisation, gestion et subtilités du cache (L1, L2), mécanismes transactionnels, langage de requêtage… Tous ces aspects et bien d’autres sont détaillés et illustrés afin de vous apporter les clefs pour vos prochains projets.
Découvrez dès aujourd’hui les slides de cette formation, mis à disposition dans le cadre de l’OpenFormation.
Open Swoole is a PHP extension that allows PHP applications to take advantage of asynchronous and coroutine programming models for building large scale concurrent systems. It was created in 2012 and provides features like TCP/UDP/HTTP servers, clients and protocols as well as coroutine support to improve performance over traditional PHP architectures.
This document provides an introduction to Node.js, including what it is, its advantages, and how its process model works. Node.js is an open-source JavaScript runtime environment that uses asynchronous programming and non-blocking I/O. It allows building highly scalable server-side applications using JavaScript. Unlike traditional web servers which use threads, Node.js runs in a single process with a single thread and handles I/O asynchronously so it can handle multiple requests concurrently without blocking. This increases performance and scalability compared to traditional threaded servers.
Django Framework and Application StructureSEONGTAEK OH
The document describes the structure and dependencies of a typical Django application. It shows that a Django project uses the Django framework and contains Django applications, which follow the MTV pattern of models, templates, and views. The main components are the database, templates, views, URLs, forms, serializers, and models, with views and models interacting with the database via the ORM and templates being used to render responses from views.
1. The document describes the common HTTP methods used to retrieve or send data over the web, including GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, and TRACE.
2. GET is used to retrieve a resource, HEAD is like GET but only returns headers, and POST sends data to a server like form data or file uploads.
3. PUT replaces a resource with uploaded content, DELETE removes a resource, and CONNECT establishes a tunnel. OPTIONS returns supported methods and TRACE echoes a request for debugging.
Go 語言 (又稱Golang) 是 Google 推出新一代的強大語言,今年 3 月 Google 公佈了去年底統計的問卷結果,發現 63% 用 Go 來寫網站,38% 用來開發系統程式,35% 用來做 DevOps,本次議題將會帶您瞭解為什麼 Go 語言適合打造微服務架構,Go 語言大給微服務什麼樣的特性以及 Go 語言適合用來開發什麼樣的系統?
Jenkins to Gitlab - Intelligent Build-PipelinesChristian Münch
At netz98 we moved from Jenkins to Gitlab. The slides show some insides about Testing of PHP libraries, Magento 1 and Magento 2 modules. How to setup a scalable and fast Gitlab-Pipeline with Docker images.
Formation JPA Avancé / Hibernate gratuite par Ippon 2014Ippon
Les ORM, c’est pratique. Mais cela peut rapidement devenir complexe ou subtile. JPA permet de rapidement modéliser la couche d’accès aux données avec une facilité indiscutable. Cependant, il est préférable de bien en comprendre le fonctionnement pour éviter quelques anti patterns fâcheux.
La formation JPA Avancé proposée par Ippon détaille les aspects techniques et permet d’aller plus loin dans la compréhension et la maîtrise. Enrichie par des TP très fournis lorsqu’elle est dispensée par les formateurs Ippon, elle permet d’assimiler en 3 jours les subtilités et offre les outils pour réaliser une couche d’accès aux données de qualité, performante et maintenable.
Techniques de modélisation, gestion et subtilités du cache (L1, L2), mécanismes transactionnels, langage de requêtage… Tous ces aspects et bien d’autres sont détaillés et illustrés afin de vous apporter les clefs pour vos prochains projets.
Découvrez dès aujourd’hui les slides de cette formation, mis à disposition dans le cadre de l’OpenFormation.
Open Swoole is a PHP extension that allows PHP applications to take advantage of asynchronous and coroutine programming models for building large scale concurrent systems. It was created in 2012 and provides features like TCP/UDP/HTTP servers, clients and protocols as well as coroutine support to improve performance over traditional PHP architectures.
This document provides an introduction to Node.js, including what it is, its advantages, and how its process model works. Node.js is an open-source JavaScript runtime environment that uses asynchronous programming and non-blocking I/O. It allows building highly scalable server-side applications using JavaScript. Unlike traditional web servers which use threads, Node.js runs in a single process with a single thread and handles I/O asynchronously so it can handle multiple requests concurrently without blocking. This increases performance and scalability compared to traditional threaded servers.
Django Framework and Application StructureSEONGTAEK OH
The document describes the structure and dependencies of a typical Django application. It shows that a Django project uses the Django framework and contains Django applications, which follow the MTV pattern of models, templates, and views. The main components are the database, templates, views, URLs, forms, serializers, and models, with views and models interacting with the database via the ORM and templates being used to render responses from views.
1. The document describes the common HTTP methods used to retrieve or send data over the web, including GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, and TRACE.
2. GET is used to retrieve a resource, HEAD is like GET but only returns headers, and POST sends data to a server like form data or file uploads.
3. PUT replaces a resource with uploaded content, DELETE removes a resource, and CONNECT establishes a tunnel. OPTIONS returns supported methods and TRACE echoes a request for debugging.
This is an introductory presentation on Svelte ( Svelte 3) .
Outline is as follows:
Introduction
High level Comparison with A, R, V
History of Svelte
What is Svelte?
Features of Svelte
Lifecycle Hooks
Store with a Demo
Drawbacks of Svelte
Demo
Conclusion
Video on Youtube: https://www.youtube.com/watch?v=76hQBnjhVdY&feature=youtu.be
This document provides an overview of OpenStack APIs and the WSGI (Web Server Gateway Interface) that powers them. It begins with an introduction to WSGI and how OpenStack services are implemented as WSGI applications. It then demonstrates how the OpenStack APIs can be accessed via libraries like novaclient or directly with HTTP requests. Code examples are provided showing how to authenticate against Keystone and retrieve images using urllib2. The document concludes with explanations of how WSGI, WebOb, and Paste are used to implement the OpenStack "web stack".
Reactive Programming In Java Using: Project ReactorKnoldus Inc.
The session provides details about reactive programming with reactive streams. The purpose of Reactive Streams is to provide a standard for asynchronous stream processing with non-blocking backpressure.”
This concept is explained using Project reactor.
The document discusses best practices for using the Java Persistence API (JPA). It covers:
- The entity manager and persistence context manage entities within a scope like a transaction.
- Entities transition between managed, detached, and removed states that impact database synchronization.
- Queries retrieve and manage entities from the persistence context and database.
- Transactions and locking strategies like optimistic and pessimistic concurrency control how changes are made.
- Extended and transaction scoped persistence contexts determine entity lifetime and caching.
- The second level cache can improve performance by caching entities across contexts.
This document discusses Node.js functions, modules, and exporting modules. It covers defining functions, parameters, and return values. It also covers the different types of modules in Node.js including core modules, local modules, and third party modules. Finally, it discusses how to export variables, functions, objects, and classes from modules using module.exports.
PARTIE 2 : Développez une application web dynamique et interactive : Comprendre les Sessions et les Cookies. Manipuler les formulaires et leurs éléments. Présenter Mysql, définir une BD, Comprendre le langage SQL et Apprendre à manipuler phpMyadmin. Faire la connexion avec la base de données et réaliser des opérations CRUD. Tout ceci accompagné avec des exemples et exercices.
Next.js is a React framework that allows building universal apps that work on both client and server. It addresses issues with SEO, performance, and code splitting in single-page apps. Next.js provides out-of-the-box features like server-side rendering, automatic code splitting, optimized builds, and more. It has a simple project structure where pages are individual React components and routing is file-based. While routing can be customized, the default routing only supports route paths that resolve to page files. Overall, Next.js streamlines universal React apps with its features and optimizations.
So you're starting a startup an need best practices for your engineering team. Well, look for:
1. Versionning
2. Branching and Pull Requests (GitHub Flow)
3. Deployment & Continuous Delivery
4. Rollback Strategies
5. Testing
6. Backups
7. Monitoring
8. Communication
9. Issue Tracker / Project Management
This deck talks about the tool used by Le Wagon and startup coached by Le Wagon.
Le Wagon is the French innovating coding school for entrepreneurs. More info on https://www.lewagon.com
This document discusses refactoring Django applications using a hexagonal design pattern to improve modularity, loose coupling, and testability. It describes how a typical Django application can become coupled to the framework over time as new features are added. The hexagonal design pattern advocates separating the core domain model from the framework so it does not depend on Django classes or modules. It also promotes using ports and adapters so the domain communicates with the framework through well-defined interfaces. An example voting application is refactored from directly using Django models and methods to employing a separate poll engine module and repository that interacts with the models through adapters. This improves encapsulation, removes framework dependencies, and allows easier testing of the domain logic.
Introduction to web application development with Vue (for absolute beginners)...Lucas Jellema
In this slide deck I show you how you can easily and quickly create quite rich web applications with Vue 3 – without having to study complex concepts or understand many technical details. I have only recently learned how to work with Vue 3 myself and now is the best time for me to share my learning experience (and my enthusiasm) with you. I know what I found essential to understand and what most got me excited in these early steps (what was a little bit hard to grasp). I believe that I can present my steps and guide you to experience the same fun and have a similarly gratifying experience. I am not an expert in this subject – I have barely learned how to walk and that is why I can help you with these first steps with Vue.
In this deck, I do not explain how Vue works. I do not really know that. I will show you how to work with it and how to create web applications that are functional, appealing, fast and responsive.
The approach I am taking is straightforward:
• I will tell you a little bit about web development, browsers and reactive frameworks
• I will show the hello world of Vue applications
• I will explain about components and nesting, events, data binding and reactive behavior and demonstrate these concepts
• I will introduce Vue UI Component libraries – and with no effort at all we will launch our application to the next level – with rich components to explore, manipulate, visualize data collections
• We will publish the web application from our development environment to where the whole world could see it – using GitHub Pages
• As bonus topic – we discuss state management
At the end of this session you will be able to quickly create a simple yet rich web application with Vue 3. You have a starting point to further evolve your skills with the many online resources I am convinced that you will enjoy your newfound powers and the simplicity and power of Vue 3.
Note: a tutorial accompanies this slide deck - see https://github.com/lucasjellema/code-face-vue3-intro-reactiive-webapps-aug2023/blob/main/README.md
The document discusses Project Reactor, a library for building asynchronous and non-blocking applications in Java or Kotlin. It explains the differences between blocking and non-blocking code, provides examples of using Project Reactor, and highlights some gotchas. Benchmarking results show that a non-blocking Dropwizard application using Project Reactor can handle over 12 times as many requests per second as a blocking version. The document also includes links to code samples on GitHub that demonstrate concepts like combining different publishers, exception handling, and caching.
Understanding Monorepos: What you need to know
Benjamin Cabanes & Philip Fulcher
Monorepos are hot right now, especially among Web developers. We’re here to help you understand what they are, what problems they solve, and how Nx makes them delightful. You can break down barriers and reclaim the collaboration you’ve been missing.
Nginx is a popular tool for load balancing and caching. It offers high performance, reliability and flexibility for load balancing through features like upstream modules, health checks, and request distribution methods. It can also improve response times and handle traffic spikes through caching static content and supporting techniques like stale caching.
Advantages and disadvantages of a monorepoIanDavidson56
A monorepo is a single repository that contains all code for a company, team, or product rather than having separate repositories. Key advantages of a monorepo include consistency across language versions, dependencies, and code style which makes upgrades and refactors easier. However, a monorepo also has disadvantages such as a more complex build process, inability to version internal libraries, and difficulty searching and managing the large codebase. While a monorepo provides benefits like easy code reuse and setup, the tradeoff is less flexibility and potential slowdowns from the large size.
Spring Boot is a framework for creating stand-alone, production-grade Spring-based applications that can be started using java -jar without requiring any traditional application servers. It is designed to get developers up and running as quickly as possible with minimal configuration. Some key features of Spring Boot include automatic configuration, starter dependencies to simplify dependency management, embedded HTTP servers, security, metrics, health checks and externalized configuration. The document then provides examples of building a basic RESTful web service with Spring Boot using common HTTP methods like GET, POST, PUT, DELETE and handling requests and responses.
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
The power of Gatling is the DSL it provides to allow writing meaningful and expressive tests. We provide an overview of the framework, a description of their development environment and goals, and present their test results.
Source code available https://github.com/lawlessc/random-response-time
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
This is an introductory presentation on Svelte ( Svelte 3) .
Outline is as follows:
Introduction
High level Comparison with A, R, V
History of Svelte
What is Svelte?
Features of Svelte
Lifecycle Hooks
Store with a Demo
Drawbacks of Svelte
Demo
Conclusion
Video on Youtube: https://www.youtube.com/watch?v=76hQBnjhVdY&feature=youtu.be
This document provides an overview of OpenStack APIs and the WSGI (Web Server Gateway Interface) that powers them. It begins with an introduction to WSGI and how OpenStack services are implemented as WSGI applications. It then demonstrates how the OpenStack APIs can be accessed via libraries like novaclient or directly with HTTP requests. Code examples are provided showing how to authenticate against Keystone and retrieve images using urllib2. The document concludes with explanations of how WSGI, WebOb, and Paste are used to implement the OpenStack "web stack".
Reactive Programming In Java Using: Project ReactorKnoldus Inc.
The session provides details about reactive programming with reactive streams. The purpose of Reactive Streams is to provide a standard for asynchronous stream processing with non-blocking backpressure.”
This concept is explained using Project reactor.
The document discusses best practices for using the Java Persistence API (JPA). It covers:
- The entity manager and persistence context manage entities within a scope like a transaction.
- Entities transition between managed, detached, and removed states that impact database synchronization.
- Queries retrieve and manage entities from the persistence context and database.
- Transactions and locking strategies like optimistic and pessimistic concurrency control how changes are made.
- Extended and transaction scoped persistence contexts determine entity lifetime and caching.
- The second level cache can improve performance by caching entities across contexts.
This document discusses Node.js functions, modules, and exporting modules. It covers defining functions, parameters, and return values. It also covers the different types of modules in Node.js including core modules, local modules, and third party modules. Finally, it discusses how to export variables, functions, objects, and classes from modules using module.exports.
PARTIE 2 : Développez une application web dynamique et interactive : Comprendre les Sessions et les Cookies. Manipuler les formulaires et leurs éléments. Présenter Mysql, définir une BD, Comprendre le langage SQL et Apprendre à manipuler phpMyadmin. Faire la connexion avec la base de données et réaliser des opérations CRUD. Tout ceci accompagné avec des exemples et exercices.
Next.js is a React framework that allows building universal apps that work on both client and server. It addresses issues with SEO, performance, and code splitting in single-page apps. Next.js provides out-of-the-box features like server-side rendering, automatic code splitting, optimized builds, and more. It has a simple project structure where pages are individual React components and routing is file-based. While routing can be customized, the default routing only supports route paths that resolve to page files. Overall, Next.js streamlines universal React apps with its features and optimizations.
So you're starting a startup an need best practices for your engineering team. Well, look for:
1. Versionning
2. Branching and Pull Requests (GitHub Flow)
3. Deployment & Continuous Delivery
4. Rollback Strategies
5. Testing
6. Backups
7. Monitoring
8. Communication
9. Issue Tracker / Project Management
This deck talks about the tool used by Le Wagon and startup coached by Le Wagon.
Le Wagon is the French innovating coding school for entrepreneurs. More info on https://www.lewagon.com
This document discusses refactoring Django applications using a hexagonal design pattern to improve modularity, loose coupling, and testability. It describes how a typical Django application can become coupled to the framework over time as new features are added. The hexagonal design pattern advocates separating the core domain model from the framework so it does not depend on Django classes or modules. It also promotes using ports and adapters so the domain communicates with the framework through well-defined interfaces. An example voting application is refactored from directly using Django models and methods to employing a separate poll engine module and repository that interacts with the models through adapters. This improves encapsulation, removes framework dependencies, and allows easier testing of the domain logic.
Introduction to web application development with Vue (for absolute beginners)...Lucas Jellema
In this slide deck I show you how you can easily and quickly create quite rich web applications with Vue 3 – without having to study complex concepts or understand many technical details. I have only recently learned how to work with Vue 3 myself and now is the best time for me to share my learning experience (and my enthusiasm) with you. I know what I found essential to understand and what most got me excited in these early steps (what was a little bit hard to grasp). I believe that I can present my steps and guide you to experience the same fun and have a similarly gratifying experience. I am not an expert in this subject – I have barely learned how to walk and that is why I can help you with these first steps with Vue.
In this deck, I do not explain how Vue works. I do not really know that. I will show you how to work with it and how to create web applications that are functional, appealing, fast and responsive.
The approach I am taking is straightforward:
• I will tell you a little bit about web development, browsers and reactive frameworks
• I will show the hello world of Vue applications
• I will explain about components and nesting, events, data binding and reactive behavior and demonstrate these concepts
• I will introduce Vue UI Component libraries – and with no effort at all we will launch our application to the next level – with rich components to explore, manipulate, visualize data collections
• We will publish the web application from our development environment to where the whole world could see it – using GitHub Pages
• As bonus topic – we discuss state management
At the end of this session you will be able to quickly create a simple yet rich web application with Vue 3. You have a starting point to further evolve your skills with the many online resources I am convinced that you will enjoy your newfound powers and the simplicity and power of Vue 3.
Note: a tutorial accompanies this slide deck - see https://github.com/lucasjellema/code-face-vue3-intro-reactiive-webapps-aug2023/blob/main/README.md
The document discusses Project Reactor, a library for building asynchronous and non-blocking applications in Java or Kotlin. It explains the differences between blocking and non-blocking code, provides examples of using Project Reactor, and highlights some gotchas. Benchmarking results show that a non-blocking Dropwizard application using Project Reactor can handle over 12 times as many requests per second as a blocking version. The document also includes links to code samples on GitHub that demonstrate concepts like combining different publishers, exception handling, and caching.
Understanding Monorepos: What you need to know
Benjamin Cabanes & Philip Fulcher
Monorepos are hot right now, especially among Web developers. We’re here to help you understand what they are, what problems they solve, and how Nx makes them delightful. You can break down barriers and reclaim the collaboration you’ve been missing.
Nginx is a popular tool for load balancing and caching. It offers high performance, reliability and flexibility for load balancing through features like upstream modules, health checks, and request distribution methods. It can also improve response times and handle traffic spikes through caching static content and supporting techniques like stale caching.
Advantages and disadvantages of a monorepoIanDavidson56
A monorepo is a single repository that contains all code for a company, team, or product rather than having separate repositories. Key advantages of a monorepo include consistency across language versions, dependencies, and code style which makes upgrades and refactors easier. However, a monorepo also has disadvantages such as a more complex build process, inability to version internal libraries, and difficulty searching and managing the large codebase. While a monorepo provides benefits like easy code reuse and setup, the tradeoff is less flexibility and potential slowdowns from the large size.
Spring Boot is a framework for creating stand-alone, production-grade Spring-based applications that can be started using java -jar without requiring any traditional application servers. It is designed to get developers up and running as quickly as possible with minimal configuration. Some key features of Spring Boot include automatic configuration, starter dependencies to simplify dependency management, embedded HTTP servers, security, metrics, health checks and externalized configuration. The document then provides examples of building a basic RESTful web service with Spring Boot using common HTTP methods like GET, POST, PUT, DELETE and handling requests and responses.
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
The power of Gatling is the DSL it provides to allow writing meaningful and expressive tests. We provide an overview of the framework, a description of their development environment and goals, and present their test results.
Source code available https://github.com/lawlessc/random-response-time
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
ApacheConNA 2015: What's new in Apache httpd 2.4Jim Jagielski
The document discusses the new features of Apache HTTP Server version 2.4, including performance improvements through more efficient modules and data structures, enhanced configuration options, new modules for capabilities like Lua scripting and remote IP access, and improved proxy functionality for dynamic and cloud environments. Key areas covered are performance, configuration, new modules, and proxy features.
Here are some ways to optimize the code:
1. Use strtr() instead of preg_replace() since it avoids the overhead of regular expressions.
2. Define the replacement array outside the loop to avoid redefining it on each iteration.
3. Use direct string concatenation instead of sprintf() for better performance.
4. Avoid function calls inside the loop like sizeof(). Define the length before the loop for better performance.
5. Consider using string replacement/manipulation functions like str_replace() instead of redefining/reconcatenating strings on each loop iteration.
So in summary, the optimized code would be:
$rep = ['-' => '*', '.' => '*
PHP & Performance document discusses various techniques to improve PHP and web server performance. Some key points:
- Compilation of PHP scripts can consume significant time, opcode caches like APC reduce this.
- Profiling tools like APD and XDebug help identify bottlenecks in PHP code. Optimizations like output buffering, reducing output, content compression and database tuning can improve performance.
- Server configuration like Apache optimizations for file I/O, syscalls and KeepAlive headers also impact performance. PHP settings like disabling register_globals and using opcaches help.
- Application techniques like avoiding unnecessary functions, using class constants, and reducing regex usage in PHP code provide performance benefits.
HAProxy is a free, open-source load balancer and proxy server. It is fast, reliable, and widely used. Some common uses of HAProxy include load balancing HTTP traffic, using access control lists to route requests, handling HTTPS traffic, load balancing MySQL databases, and proxying SSH connections. The latest version of HAProxy introduced new features like connection tracking, limiting connections per IP address, and peer synchronization between HAProxy instances. HAProxy provides high performance, flexibility, and scalability for traffic routing and distribution.
This document describes how to build a scalable socket server using Node.js. It discusses using multiple servers and a message queue like Redis to utilize multiple CPU cores. It also describes using a load balancer like HAProxy to distribute requests from clients across servers. An example configuration is provided using a single computer with 4 CPU cores, Redis for centralized messaging, 2 Node.js servers, and HAProxy for load balancing.
Covers Performance improvements with the Symfony web framework for PHP.
- Google cares about user happiness, Google owns your search traffic ...so Google put page speed in PageRank (and crawl speed)
- Your site is more trustworthy and less frustrating
- Increase page views and ad impressions
- Increase conversions and revenue! It pays for itself!
- Bonus: run less app servers
Let's look at ways how to make PHP applications remember what your user did on the last web page.
The first half will be about the classic PHP sessions, what the SessionHandlerInterface is about and why all of it's methods are important for a successful alternative implementation.
The second half will explore alternatives to the problems created using PHP sessions, including alternatives to sessions: Splitting the problem on the server or moving the data to the client.
This document discusses socket programming and network programming concepts like TCP and UDP. It provides examples of using Netcat and Python for sockets. It also summarizes the architecture of Nginx and Openresty, a framework that embeds Lua in Nginx allowing full web applications to run within the Nginx process for high performance and scalability. Openresty allows accessing and modifying requests and responses with Lua scripts.
This document provides an introduction and overview of Node.js. It discusses the brief history of server-side JavaScript, how Node.js was created to enable easy push capabilities for websites, and its growth in popularity in the following years. The document also covers key aspects of Node.js like non-blocking I/O, event loops, streams, modules, and dependency management with NPM. Popular frameworks like Express, Hapi, and tools/concepts like IoT, desktop apps, and real-time apps are also mentioned.
Finding and fixing bugs is a major chunk of any developers time. This talk describes the basic rules for effective debugging in any language, but shows how the tools available in PHP can be used to find and fix even the most elusive error
PHP is a widely used open source scripting language for web development. It was originally created in 1995 to generate dynamic web pages. PHP code is embedded within HTML code and interpreted on the server side to create the web page output. PHP scripts can connect to databases like MySQL to store and retrieve data, send emails, and perform other tasks to interact with the web server. Common PHP features include variables, operators, flow control, functions, classes and objects, arrays, sessions, cookies, and connecting to databases.
OrientDB v2.2 introduces several new features including live queries, parallel queries, command caching, sequences, incremental backups, improved security features, an easier distributed configuration, load balancing strategies, and SQL commands for managing high availability configurations. It also introduces the Teleporter tool for migrating data from relational databases like Oracle, SQL Server, MySQL, and PostgreSQL into OrientDB.
Introduction to ZooKeeper - TriHUG May 22, 2012mumrah
Presentation given at TriHUG (Triangle Hadoop User Group) on May 22, 2012. Gives a basic overview of Apache ZooKeeper as well as some common use cases, 3rd party libraries, and "gotchas"
Demo code available at https://github.com/mumrah/trihug-zookeeper-demo
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
This document discusses Rhebok, a high performance Rack handler written in Ruby. Rhebok uses a prefork architecture for concurrency and achieves 1.5-2x better performance than Unicorn. It implements efficient network I/O using techniques like IO timeouts, TCP_NODELAY, and writev(). Rhebok also uses the ultra-fast PicoHTTPParser for HTTP request parsing. The document provides an overview of Rhebok, benchmarks showing its performance, and details on its internals and architecture.
Similar to "Swoole: double troubles in c", Alexandr Vronskiy (20)
"What I learned through reverse engineering", Yuri ArtiukhFwdays
In recent years, I have gained most of my knowledge through reverse engineering, how I did it and what I learned during this period, I decided to share. All this concerns graphic programming, performance, best practices in the frontend.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
"Micro frontends: Unbelievably true life story", Dmytro PavlovFwdays
A real life story about the experience of using Micro frontends in an existing Enterprise product. Problems and their solutions on the way from the integration of a separate component to an extensible No-code platform.
"Objects validation and comparison using runtime types (io-ts)", Oleksandr SuhakFwdays
A common task in modern JS is parsing, validating and then comparing JSON objects. In this talk I will quickly go through most common ways to parse/validate and compare objects we use today and then focus more on how runtime types (based on io-ts) can help make such tasks easier and quicker to implement.
"JavaScript. Standard evolution, when nobody cares", Roman SavitskyiFwdays
Should we take a look at JavaScript when everyone is writing in TypeScript? What happens to the standard? What did we get last year? What new features can we expect this and next year? And most importantly, when will Observer be standardized?
Let's try to answer all these questions and even a little more, dream about the future, and enjoy that Observer is alive (or not).
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...Fwdays
Case study of how small team in Preply started with inheriting an existing ranking model to being able to produce a model per day. In this talk we'll cover steps to take if you find yourself in a similar situation: what kind of technology and processes can you introduce in order to achieve a great speedup in a development speed.
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil TopchiiFwdays
In my talk, I will tell about the world of GenAI services beyond GPT-wrappers and how we developed and scaled GenAI-centric applications. I'll share personal experiences about the obstacles, lessons, and strategic tools and methodologies that were key in taking GenAI applications from 0 to 1. I'll talk about the challenges we faced when launching LLM-based and image generative applications and delivering them to end users, and what conclusions and solutions were made.
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
Python engineers are introduced to the transformative potential of Large Language Models (LLMs) in the realm of advanced data analysis and the application of Semantic Kernel techniques. We will talk about how LLMs like ChatGPT can be integrated into Python environments to automate data processing, enhance predictive modeling, and unlock deeper insights from complex datasets. The session will delve into practical strategies for embedding Semantic Kernel methods within Python projects, illustrating how these advanced techniques can refine the accuracy of machine learning models by embedding domain-specific knowledge directly into the analysis process. Attendees will leave with a clear roadmap for leveraging the combined power of LLMs and Semantic Kernels, equipped with actionable knowledge to drive innovation in their data analysis projects and beyond, marking a significant leap forward in the evolution of Python engineering practices.
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
Federated learning. Algorithmic solution to the problem of privacy preserving ML. Pieces involved to support the training with NVIDIA Flare as example. How newest legislation affects federated learning.
"What is a RAG system and how to build it",Dmytro SpodaretsFwdays
Today, large language models are becoming an integral part of almost every IT solution. However, their use is often accompanied by certain limitations, such as the relevance of information or its depth and specificity. One of the ways to overcome these limitations is the method of working with LLMs - RAG (Retrieval Augmented Generation).
In an ideal world, you would write Python code and then it would work perfectly. But unfortunately, it doesn't work in this manner. In my talk, I'll cover how to efficiently debug your programs, especially in cloud environments or inside Kubernetes.
MLOps (Machine Learning Operations) is a recent buzzword, that trends a lot. Let's figure out together how maintaining applications with machine learning components is significantly different from maintaining applications without them.
We will look into MLOps best practices and typical problems and their implementations/solutions in real world production.
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
Ever seen a code base where understanding a simple method meant jumping through tangled class hierarchies? We all have! And while "Favor composition over inheritance!" is almost as old as object-oriented programming, strictly avoiding all types of subclassing leads to verbose, un-Pythonic code. So, what to do?
The discussion on composition vs. inheritance is so frustrating because far-reaching design decisions like this can only be made with the ecosystem in mind – and because there's more than one type of subclassing!
Let's take a dogma-free stroll through the types of subclassing through a Pythonic lens and untangle some patterns and trade-offs together. By the end, you'll be more confident in deciding when subclassing will make your code more Pythonic and when composition will improve its clarity.
"Distributed graphs and microservices in Prom.ua", Maksym KindritskyiFwdays
The current architecture of Prom.ua is built on microservices and GraphQL API, but it was not always like that. In this talk, I'll tell you how far we've come and how we've made using graphs in a microservice architecture convenient and simple. I will talk about the problems we faced and how we overcame them, made our development process more accessible, deployments faster, and the remains of the monolith less loaded.
"Rethinking the existing data loading and processing process as an ETL exampl...Fwdays
ETL stands for extract, transform, load. It's a process that combines data from different sources into a single repository for further processing, analysis, and utilization.
This talk provides an example of how pandas can be used to solve ETL tasks as a stage in the evolution of the data intake component. This involves preliminary validation, filtering, and conversion of data according to a set of business rules and internal representation, with intermediate combination with other sources.
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...Fwdays
I’m confident that many IT professionals are currently facing the same situation I was in a few months ago. Mobilization, uncertainty. How can I be maximally beneficial to the country with my experience and continue professional development in such circumstances? Since the onset of the full-scale invasion, I've been actively volunteering and assisting the army. Mobilization became the next logical step.
I want to share:
My journey in IT, volunteering, and the beginning of my service in the Armed Forces
Impressions from the first few months
Which Soft Skills are helpful in this context
I aim to dispel myths about the mobilization process and projects of the Armed Forces. Address your questions
And yes, military personnel can travel abroad during their leave.
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...Fwdays
The leader must be strong all the time. The leader cannot afford to make mistakes, let alone fail in front of their team. Is that really true? Nick Gicinto, a cybersecurity leader with over 25 years of experience, who has worked for the CIA and has built security systems from scratch at Tesla and Uber, fully hiring teams for these projects, will talk about the importance of being vulnerable to build trust within a team.
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...Fwdays
Sharing open feedback can be difficult because it equals much work on yourself. However, feedback needs attention and a special place in the corporate culture. It helps to grow dynamically, build a team of like-minded people and achieve powerful results.
In the presentation, I will talk about:
The ability to work with feedback as a soft, solid skill in developing technical specialists.
A list of difficulties that prevent quality work with feedback.
The 4A Framework is a tool for successful giving and receiving feedback.
I will also help specialists learn the following:
Form constructive feedback and understand how and when to give it.
Work analytically with the received feedback.
Feel free to share your thoughts and be heard.
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...Fwdays
Will discuss:
Current communication challenges, including mishaps and toxic versus productive interactions.
Ever wondered about PDP? It’s likely because its relevance to career planning, even outside your current company, hasn’t been fully spotlighted.
Exploring how PDP functions within career planning, applicable even if you’re eyeing an exit.
“Who do I aspire to become?”
Summarizing key points with a reference to a practical form you can download to use.
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...Fwdays
This talk will reveal four destructive communication patterns that can undermine team spirit, reduce productivity and cause conflict, and offer effective strategies for neutralizing them.
Let's start with exciting storytelling about a fictional team of developers working on Scrum. You will learn about situations that their team member noticed during team meetings.
Next, we will analyze "The Gottman Four Horsemen" model, which describes the four "horsemen of the apocalypse" of work relationships: criticism, defensiveness, contempt, and stonewalling. For each of these patterns, specific "antidotes" will be offered that allow you to build healthier and more productive relationships in the team.
Finally, we'll look at why this topic is critical to team productivity, drawing on Google's "Project Aristotle" research. Special attention will be paid to the concept of psychological safety, which is a key factor in the success of high-performance teams.
This talk will not only provide valuable insights and tools for improving communication and management in Tech teams, but will also help each member better understand their own contribution to the overall success of the team.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Full-RAG: A modern architecture for hyper-personalizationZilliz
Mike Del Balso, CEO & Co-Founder at Tecton, presents "Full RAG," a novel approach to AI recommendation systems, aiming to push beyond the limitations of traditional models through a deep integration of contextual insights and real-time data, leveraging the Retrieval-Augmented Generation architecture. This talk will outline Full RAG's potential to significantly enhance personalization, address engineering challenges such as data management and model training, and introduce data enrichment with reranking as a key solution. Attendees will gain crucial insights into the importance of hyperpersonalization in AI, the capabilities of Full RAG for advanced personalization, and strategies for managing complex data integrations for deploying cutting-edge AI solutions.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Infrastructure Challenges in Scaling RAG with Custom AI modelsZilliz
Building Retrieval-Augmented Generation (RAG) systems with open-source and custom AI models is a complex task. This talk explores the challenges in productionizing RAG systems, including retrieval performance, response synthesis, and evaluation. We’ll discuss how to leverage open-source models like text embeddings, language models, and custom fine-tuned models to enhance RAG performance. Additionally, we’ll cover how BentoML can help orchestrate and scale these AI components efficiently, ensuring seamless deployment and management of RAG systems in the cloud.
3. ● What existing problems need to solve?
● Why choose Swoole?
● How solve it with Swoole?
● What unexpected troubles could happens?
● Show methods to avoid then (or not?)
● Talk about theory
● Examples in a context of a real project
Intro
4. Side Effects of
- PHP no dying (long-lived)
- Concurrency Async
- Shared Memory access
Intro
6. Intro. About project
Current AVG metrics:
- GA online users: ~3500
- API RPS: ~200
- DB transactions: ~3000/sec
- Products count: ~25kk
Consuming resources:
- PHP: 60 vCPU
- ElasticSearch: 40 vCPU
- PostgreSQL: 16 vCPU
- Others: 20 vCPU
7. ● Not optimized resources usage.
● Hard tuning horizontal scale.
● Over-complicated infrastructure
● Not well performance (TTFB)
Why? Problems
Database
PHP PHP
PHP PHP
Elastic Elastic
Elastic
Other
4x times
8. ● Not optimized resources usage.
● Hard tuning horizontal scale.
● Over-complicated infrastructure
● Not well performance (TTFB)
Why? Problems
PHP
4 vCPU
PHP
16 vCPU
VS
9. ● Not optimized resources usage.
● Hard tuning horizontal scale.
● Over-complicated infrastructure
● Not well performance (TTFB)
Why? Problems
Docker, k8s, Terraform, Helm, GitHub
Actions, Envs: prod+stage+devs+local, Go,
Typescript
10. ● Not optimized resources usage.
● Hard tuning horizontal scale.
● Over-complicated infrastructure
● Not well performance (TTFB)
Why? Problems
11. ● ASYNC entire ecosystem
● Performance
● Easy to start
- Coroutine based concurrent asynchronous IO
- Event Loop
- Process management
- In-memory storage and management
- Async TCP/UDP/HTTP/WebSocket/HTTP2/FastCGI client
and servers
- Async Task API
- Channels, Locks, Timer, Scheduler
NO PECL: ext-pcntl, ext-pthreads, ext-event
Why Swoole?
12. Milestone 1: PHP no die
● Run HTTP Server
○ replace NGINX+FPM
○ simplify infrastructure (less DevOps, easy building & k8s configs)
○ change (unified) operations: CI / CD / local env
● Prepare bootstrap
● Implement best practices in shared memory usage to avoid side-effects
Plan
13. ● Server Mode: SWOOLE_PROCESS / SWOOLE_BASE
● Dispatch Mode: 1-9 (Round-Robin, Fixed, Preemptive, etc)
● Worker Num: 1-1000 (CPU*2)
● Max Request: 0-XXX (0)
Other Options: Limits, Timeouts, Memory buffers...
php bin/http-server.php
Swoole HTTP Server
https://www.swoole.co.uk/docs/modules/swoole-server/configuration
MUST SEE:
<?php
$server = new SwooleHTTPServer("127.0.0.1", 9501);
$server->on('Request', function(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
$response->end('<h1>Hello World!</h1>');
});
$server->start();
14. ● Scan config files, env, run reflection, attributes, build DI, generate proxy, warm caches:
● NO NEED cache layer anymore
● NOW it before real start http server
(if no traffic: readiness probe=negative)
PSR-7 HTTP Messages
PSR-15 Middleware
PSR-11 Container
bootstrap in master
http request in worker process
Bootstrap app once
fork state
15. What are the problems?
- NO SUPER GLOBALS ($_SERVER, ...)
- No PHP Session (it is CLI SAPI)
- Stateful services that should mutate on each request
- DI containers - global state too.
Shared Memory
16. Any wrong example?
Shared Memory
https://github.com/chrisguitarguy/RequestIdBundle/blob/main/src/EventListener/RequestIdListener.php
public function onRequest(RequestEvent $event) : void
{
if (!$this->isMainRequest ($event)) {
return;
}
$req = $event->getRequest();
if ($this->trustRequest && ($id = $req->headers->get($this->requestHeader )))
{
$this->idStorage->setRequestId ($id);
return;
}
if ($id = $this->idStorage->getRequestId ()) {
$req->headers->set($this->requestHeader , $id);
return;
}
$id = $this->idGenerator ->generate();
$req->headers->set($this->requestHeader , $id);
$this->idStorage->setRequestId ($id);
}
Empty storage - no return
Generate NEW
Saving to storage
1
HTTP REQUEST:
17. Any wrong example?
Shared Memory
public function onRequest(RequestEvent $event) : void
{
if (!$this->isMainRequest ($event)) {
return;
}
$req = $event->getRequest();
if ($this->trustRequest && ($id = $req->headers->get($this->requestHeader )))
{
$this->idStorage->setRequestId ($id);
return;
}
if ($id = $this->idStorage->getRequestId ()) {
$req->headers->set($this->requestHeader , $id);
return;
}
$id = $this->idGenerator ->generate();
$req->headers->set($this->requestHeader , $id);
$this->idStorage->setRequestId ($id);
}
2
HTTP REQUEST:
Now has ID in storage
THE END
Dead code
https://github.com/chrisguitarguy/RequestIdBundle/blob/main/src/EventListener/RequestIdListener.php
19. Best practices:
- Middlewares, Factories, Proxies, Delegators
Shared Memory
use PsrHttpMessageResponseInterface
;
use PsrHttpMessageServerRequestInterface
;
use PsrHttpServerRequestHandlerInterface
;
use PsrLogLoggerInterface
;
class SomeHandler implements RequestHandlerInterface
{
public function __construct(
private Closure $appServiceFactory
,
private LoggerInterface $logger
) {}
// Idempotent method!!!
public function handle(ServerRequestInterface $request) : ResponseInterface
{
$logger = clone $this->logger;
$logger->getProcessor(
'RequestID')->setRequestId(
$request->getAttribute(
'RequestID'));
$appService = ($this->appServiceFactory)(
$logger);
return new JsonResponse($appService->createBook())
;
}
}
20. Memory leaks
… in Doctrine ORM :(
Shared Memory
https://alejandrocelaya.blog/2019/11/04/how-to-properly-handle-a-doctrine-entity-manager-on-an-expressive-appli
cation-served-with-swoole/
use DoctrineORMDecoratorEntityManagerDecorator as
EMD;
class ReopeningEntityManager extends EMD
{
private $createEm;
public function __construct (callable $createEm)
{
parent::__construct($createEm());
$this->createEm = $createEm;
}
public function open(): void
{
if (! $this->wrapped->isOpen()) {
$this->wrapped = ($this->createEm)();
}
}
class CloseDbConnectionMiddleware implements
MiddlewareInterface
{
public function __construct(
private ReopeningEntityManager $em)
{}
public function process(
ServerRequestInterface $request,
RequestHandlerInterface $handler
) : ResponseInterface
{
$this->em->open() ;
try {
return $handler->handle($request);
} finally {
$this->em->getConnection()->close() ;
$this->em->clear() ;
}
}
}
Saved in DI
21. Shared Memory
Memory leaks
BUT WHERE???
abstract class EntityManagerDecorator extends
ObjectManagerDecorator
{
/** @var EntityManagerInterface */
protected $wrapped;
public function __construct (EntityManagerInterface $wrapped)
{
$this->wrapped = $wrapped;
}
public function getRepository ($className)
{
return $this->wrapped->getRepository ($className);
}
public function getRepository ($entityName )
{
return $this->repositoryFactory ->getRepository ($this,
$entityName );
}
Somewhere far far away
in EntityManager
22. PROBLEMS DUE TO: timeouts / lifecycles
Avoid: Stateful convert to stateless
Connections
$redis = $di->get(Redis::class); // FactoryRedis: $redis->connect(...);
$redis->get('KEY1');
$redisFactory = $di->get(RedisFactory::
class);
$redisFactory()->get(‘KEY1’); // + close connect in desctructor
Request Wrapper/Delegator:
new/refresh state on each request
OR
23. Milestone 2: ASYNC
● Async theory
● Using coroutines
● Non-blocked IO solutions
● Concurrency problems review
● Again memory leaks
25. ● GET /some/action1/ SELECT sleep(1);
○ 1 worker = 1 req/sec
○ 2 worker = 2 req/sec
● GET /some/action2/ fibonacci(30);
○ 1 worker = 1 req/sec
○ 2 worker = depends on CPU cores
MIX 50/50 = 1 req/sec
50% CPU
Why/What async?
Try benchmark this:
26. Now enable coroutines: http server options: .
'enable_coroutine' => true,
Why/What async?
● GET /some/action1/
○ 1 worker = 10000 req/sec
○ 2 worker = 10000 req/sec
● GET /some/action2/
○ 1 worker = 1 req/sec
○ 2 worker = depends on CPU cores
27. Now enable coroutines: http server options: .
'enable_coroutine' => true,
Why/What async?
● GET /some/action1/
○ 1 worker = 10000 req/sec
○ 2 worker = 10000 req/sec
● GET /some/action2/
○ 1 worker = 1 req/sec
○ 2 worker = depends on CPU cores
MIX 50/50 = 2 req/sec
100% CPU
28. go(function () { // FIRST CO
echo '1';
go(function () { // SECOND CO
echo '2';
co::sleep(3); // IO (in 2 CO), will return in 3 sec
echo '6';
go(function () { // THIRD CO
echo '7';
co::sleep(2); // IO
echo "9n";
}); // END THIRD
echo '8';
}); // END SECOND
echo '3';
co::sleep(1); // Again IO but in 1 CO
echo '5';
}); // END FIRST CO
echo '4';
Coroutines
1
2
3
4
5
38. Using PostgreSQL - no PDO hooks in Swoole
● Use Coroutine Postgresql Client:
extension=swoole_postgresql.so
● Write new Driver for Doctrine ORM
● Be ready to problems
Problem Again
40. Cron jobs
- persist Deployment: run “crontab” process + list php CLI command
- CronJob (k8s) periodical run POD with “php bin/app cron:process”
- CronJob as Message (run as “bin/app messenger:consume transport.amqp”)
- + Swoole Timer async callback in PHP master process (instead linux crontab)
42. Prӕfectus
PraefectusListener
use SpiralGoridgeRelay
;
use SpiralGoridgeRPCRPC
;
use SpiralGoridgeRPCRPCInterface
;
/**
* @see SymfonyComponentMessengerWorker
*/
class PraefectusListener implements EventSubscriberInterface
{
private const IPC_SOCKET_PATH_TPL = '/tmp/praefectus_%d.sock'
;
// …
public function onMessageReceived (EventWorkerMessageReceivedEvent $event) : void
{
$this->getRpc()->call('PraefectusRPC.WorkerState' ,['pid'=>getmypid() ,'state'=>self::WORKER_BUSY]);
$this->getRpc()->call('PraefectusRPC.MessageState' , [
'id' => $messageIdStamp ->id(),
'name' => get_class( $event->getEnvelope ()->getMessage()),
'transport' => $event->getReceiverName (),
'bus' => $busName,
'state' => self::MESSAGE_STATE_PROCESSING,
]);
}
}
*not yet released on GitHub
43. ● no compatibility in code:
○ run same code in FPM & build-in http server
○ work without swoole extension (PoC - write stubs?)
○ XDebug - goodbye (use PCOV for coverage)
○ Profiling - https://github.com/upscalesoftware
Results
44. ● Doctrine + async = EVIL*
Results
* But is possible, if enough extra memory:
Each concurrency EntityManager = +100-150Mb
45. ● Swoole Table for cache - must have!
Results
Doctrine (any) cache shared between workers.
Solved case: Deployment & migration process without
50x errors