SlideShare a Scribd company logo
1© 2018 Rogue Wave Software, Inc. All Rights Reserved.
2© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Frameworks – a path to faster development
• Language considerations
• Run-time performance
• Application development
• Application deployment
• Application management
• Q & A
3© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• A number of topics in this presentation are related to, or
available from, Zend Server.
• It is important to understand what Zend Server is
• Zend Server is a complete and certified PHP distribution stack
• In addition to the PHP engine, installation of Zend Server
provides an application for managing various aspects of the
PHP application stack including:
– Monitoring
– Performance
– Security
– Applications NOTE: This is not intended to be a
Zend Server webinar; however,
aspects of Zend Server as related to
performance will be highlighted.
4© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Watch the full webinar on-demand now
5© 2018 Rogue Wave Software, Inc. All Rights Reserved.
6© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• A framework can be viewed as an application model that is
customized by an application developer to satisfy a particular
requirement
• Frameworks provide a rich set of components for commonly invoked
tasks
– Includes simple interfaces and logic structures for accessing
those libraries
• Frameworks contain source code for solving particular problems
with a particular discipline
– Provides a set of APIs (function calls) that an be used to ivoke
specific functionality with the framework
7© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Frameworks help development teams to concentrate on the specific requirements
that they are trying to satisfy without having to expend valuable time and energy to
design and implement the low-level common functions required by the application
• Development projects can be completed faster since not all of the code is being
developed from scratch
• Provides reusable, maintainable, and well-organized code
• Frameworks offer libraries and ready-to-use components – no need to reinvent the
wheel for each new project
• Once a framework is mastered, applications can be developed faster because the
framework provides a structured way to approach the development project
• A framework provides pre-written common application logic
8© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Implements PSR-7 (HTTP message interfaces)
– PSR stands for PHP Standard Recommendation – in the case of
PSR-7, the standard defines common interfaces for
representing HTTP messages and URIs for use when
communicating through PHP
• Expressive is a PSR-7 implementation as well as a middleware library
built on top of the implementation
• Expressive is an alternative to Zend Framework as it provides a
departure from the HTTP abstraction present in Zend Framework
• Expressive is middleware in that it is code that exists between the
request and the response
– Expressive provides capability to take incoming requests,
perform actions based on the request, and either complete the
response or pass delegation on to the next middleware in the
queue
9© 2018 Rogue Wave Software, Inc. All Rights Reserved.
// In public/index.php:
use ZendDiactorosResponse;
use ZendDiactorosServer;
use ZendStratigilityMiddlewareNotFoundHandler;
use ZendStratigilityMiddlewarePipe;
use function ZendStratigilitymiddleware;
use function ZendStratigilitypath;
require __DIR__ . '/../vendor/autoload.php';
$app = new MiddlewarePipe();
$server = Server::createServer([$app, 'handle'], $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
// Landing page
$app->pipe(middleware(function ($req, $handler) {
if (! in_array($req->getUri()->getPath(), ['/', ''], true)) {
return $handler->handle($req);
}
$response = new Response();
$response->getBody()->write('Hello world!');
return $response; }));
// Another page
$app->pipe(path('/foo', middleware(function ($req, $handler) {
$response = new Response();
$response->getBody()->write('FOO!');
return $response;
})));
// 404 handler
$app->pipe(new NotFoundHandler(function () {
return new Response();
}));
$server->listen(function ($req, $res) {
return $res;
});
10© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• The code snipit provides two examples of middleware
• The first is landing page
– Listens at the root path
– If the request path is empty or / then the middleware
completes the response
• If the request is not an empty path or a / then control is
delegated to the next middleware in the stack
• The second middleware matches on the path /foo (or will
match /foo, or /foo/) as well as any path beneath /foo
– If the path matches /foo than the response is provided
as it's own message
• If the path is not the root path or the /foo path than a '404
status' is composed
11© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Zend Framework is an implementation of the Model View
Controller (MVC) architecture.
• Expressive is middleware that is often simpiler to get
developers up and running with.
• Zend Framework requires developers to start learning about
dependency injection and event system before then can even
approach writing a controller.
• Middleware such as Expressive can help to get develoeprs
started more quickly, as an example:
$app->get('/hello', function($request) {
return new TextResponse('Hello, world');
})
12© 2018 Rogue Wave Software, Inc. All Rights Reserved.

• Streamline SQL requests:
– Request: SQL statement
– Action:
• Check for/establish database connection
• Execute SQL statement
– Response:
• Success/failure indication
• Data-set (if SQL statement was a select statement)
• Streamline ILE artifact requests:
– Request: ILE artifact
– Action:
• Build-up XMLToolkit call based on request type and optional data
• Execute XMLToolkit via XMLService
– Response:
• Success/failure indication
• Data set (if ILE action results in data)
13© 2018 Rogue Wave Software, Inc. All Rights Reserved.
14© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• The db2_connect() and db2_pconnect() statements are used in PHP scripts on
IBM i to establish a connection to the IBM DB2 database.
– The db2_pconnect() function establishes a persistent connection to
database – when a db2_close() is encountered on a persistent
connection, the underlying DB2 client connection remains open to serve the
next matching db2_pconnect() request
• The ibm_db2 extension can be configured to treat all db2_connect() calls as
db2_pconnect() calls
15© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Optimizations to the Zend
Engine significantly enhances
performance
• Performance gains ranging
from 20-70% have been seen
in real-world applications
– No application code
changes required!
16© 2018 Rogue Wave Software, Inc. All Rights Reserved.
17© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Three types in PHP:
– OpCache: Improves PHP performance by storing precompiled script
bytecode in shared memory – this reduces the need for the PHP engine to
parse scripts on each request.
– Data Cache:
– Page Cache:
A cache is a collection of duplicate data where the original data is
expensive to fetch or compute relative to the cache.
18© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• OPcache has a number of functions for working with and managing
the cache.
• Two functions of particular note:
– opcache_compile_file  This function can be used to
compile a php script without executing it. A typical usage of
this function is to prime the cache after a web server restart
– opcache_is_script_cached  This function returns an
indication as to whether a script is cached or not. Typically
used to detect the warming of the cache for a particular script
More information on the OPCache functions ccan be found on
php.net
http://php.net/manual/en/ref.opcache.php
19© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Data Cache is a component of Zend Server that provides a set of PHP
functions to improve performance.
• Different data types can be stored in the cache including strings,
arrays, and objects.
• Items can be stored in shared memory or disk
• Cached objects can be grouped together in namespaces.
• Data Cache is typically used when it is impracticle to cache the entire
page (see page caching)
– One example would be a form that includes credit card
numbers, social security numbers, and other personal
privileged information (PPI) that you don't want stored in a
cache
Information on working with the data cache can be found at:
http://files.zend.com/help/Zend-
Server/content/working_with_the_data_cache.htm
20© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Page Cache is a component of Zend Server and is used to improve
application performance by caching the entire output of a PHP script
– It is important to note that Page Cache does not mitigate the
dynamic capability of a PHP generated page – the dynamic
capability is maintained through a rules system.
• Use of Page Cache does not require any change to the underlying PHP
code.
• As a best practice, pages should be cached when their content is
stable and does not require frequent changes.
More information on page cache can be found at:
http://files.zend.com/help/Zend-
Server/content/page_cache_concept.htm?Highlight=page%20cache
21© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Pages to cache are defined via rules within the page caching
function:
22© 2018 Rogue Wave Software, Inc. All Rights Reserved.
A number of factors will affect the effectiveness of the cache including number of
page request, frequency of data updates on the page, cache life, etc.
23© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• The Dashboard provides information that can be useful both as
an indication of the performance of various aspects of the
application stack as well as indicating potential bottlenecks
24© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Watch the full webinar on-demand now
25© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Information available on the dashboard:
– Overview  shows information such as events, requests
per second, and average response time. Note that the
information displayed can be at the overall PHP engine
level or at the application level
– System Health  shows the number of events
(segmented as notice, critical, and warning) as well as a
breakdown of the processing to show where time is
being spent (i.e., output, database, network, disk, php)
– System Utilization  utilization metrics for active users,
cpu usage, and average memory usage
– Usage Statics  breakdown by browsers, operating
system, and geographic location of requesters
26© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Information available on the dashboard:
– Mobile Usage  breakdown of operating system
distribution and mobile vs. desktop requests
– Mobile Statistics  shows requests per second and
processing breakdown by output, database, network,
disk, and php
The "Statistics Charts" page from the Zend Server documentation can
be a good place to get more information on the statistical
information available on the dashboard:
http://files.zend.com/help/Zend-
Server/content/zend_statistics_charts.htm
27© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• The ability to monitor the PHP runtime environment, and more
importantly be able to take action based on events can be
instrumental to ensuring optimal performance of PHP applications
• A number of monitoring related functions are available:
Function Description
URL Insight View detailed reports and information on specific requests for
PHP pages located on the web server.
Events Displays events encountered/detected by Zend Server. An
event is runtime-related information collected by the Monitor
component. Events are triggered based on the monitoring
rules.
Event Rules Used to display and generate the Event rules that trigger
events.
28© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Event Rules are used to define:
– Events to monitor
– Thresholds to trigger the event
– Actions to take when an event is triggered
29© 2018 Rogue Wave Software, Inc. All Rights Reserved.
30© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Application Management in Zend Server supports a number of
key functions including:
– Initial Deployment
– Update
– Redeployment
– Rollback
– Removal
• Application installation, whether it is performed manually or
through the application packaging has three broad steps:
In a clustered environment
applications can be deployed to
multiple nodes in the cluster at the
same time!
31© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• The ability to deploy an application (not to be confused
with defining an application which I'll talk about shortly)
requires an application package
• The application package contains:
– Data (application files, deployment scripts)
– Scripts (commands/steps to follow for deployment,
rollback, remove)
– XML descriptor file (information needed to deploy
the application using the Zend Server deployment
feature)Application deployment can shorten the time it takes for actions such as
the deployment, redeployment, and update of applications by streamlining
the steps required and automating the process.
Example: A set of PHP demo scripts that shows the db2 function calls and
XMLToolkit exploitation on IBM i is delivered as a deployment package
32© 2018 Rogue Wave Software, Inc. All Rights Reserved.
33© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Z-Ray is a development tool that provides insight into the
details of a page request.
• The Z-Ray toolbar is injected into the response from the
PHP application and shown in the browser:
• Z-Ray provides application insight without having to change the
development workflow.
Summary Information for Z-Ray:
http://www.zend.com/en/products/s
erver/z-ray
34© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Information available in Z-Ray includes
35© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Backtrace information as well as IDE actions are available!
36© 2018 Rogue Wave Software, Inc. All Rights Reserved.
37© 2018 Rogue Wave Software, Inc. All Rights Reserved.
38© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• While Z-Ray is most often
used in development, it can
also be used in production
to isolate and identify run-
time issues
– By default Z-Ray is
disabled in
production
– Selective mode
provides for the
definition of
constraints for Z-
Ray including time,
URL, and browser
address
39© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Imagine the following scenario:
– Customer has implemented the open source moodle
application
• Moodle is a Learning Platform or Course Management
System (CMS)
• When the customer updated to the latest version of
Moodle they were seeing significant performance issues
(frankly, the application was unusable)
• See Next Slides for how using Z-Ray quickly identified
the issue:
40© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Step 1: Enable Z-Ray in selective mode for the application
• Step 2: From a Web Browser, make a request to the moodle URL
• Step 3: When the Z-Ray tool-bar is displayed review the execution time
information:
34.72 ms 78%
128.64 ms 21%
2.10 ms 1%
0.00 ms ~0%
41© 2018 Rogue Wave Software, Inc. All Rights Reserved.
• Step 4: Review Database Queries:
– Step 4a: Sort on the 'Time' field to bring the longest running
database statement to the top
• Sort showed that the longest running SQL statement was
the database connection statement
– Investigation of that issue showed A DNS issue within
the customer's environment
The use of Z-Ray identified the issue within a matter of minutes –
the customer had previously spent days trying to isolate the issue!!
42© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Watch the full webinar on-demand now
43© 2018 Rogue Wave Software, Inc. All Rights Reserved.
44© 2018 Rogue Wave Software, Inc. All Rights Reserved.
zend.com/downloads
Try Zend Server for IBM i
45© 2018 Rogue Wave Software, Inc. All Rights Reserved.

More Related Content

PDF
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
PPTX
Oracle REST Data Services
PDF
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
PDF
JavaOne 2014 BOF4241 What's Next for JSF?
PDF
Real-World RESTful Service Development Problems and Solutions
PDF
CON5898 What Servlet 4.0 Means To You
PDF
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
PPTX
Real world RESTful service development problems and solutions
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Oracle REST Data Services
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
JavaOne 2014 BOF4241 What's Next for JSF?
Real-World RESTful Service Development Problems and Solutions
CON5898 What Servlet 4.0 Means To You
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Real world RESTful service development problems and solutions

What's hot (20)

PDF
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
PPT
Reactive Java EE - Let Me Count the Ways!
PDF
Oracle ADF Architecture TV - Deployment - System Topologies
PPT
Anatomy of Autoconfig in Oracle E-Business Suite
PDF
Oracle ADF Architecture TV - Development - Version Control
PDF
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...
PDF
Oracle ADF Architecture TV - Design - Task Flow Transaction Options
PDF
Oracle ADF Architecture TV - Design - Designing for Internationalization
PDF
Oracle ADF Architecture TV - Development - Logging
PPTX
All of the Performance Tuning Features in Oracle SQL Developer
PDF
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
PDF
Native REST Web Services with Oracle 11g
KEY
Extending Zend_Tool
PDF
Organinzing Your PHP Projects (2010 Memphis PHP)
PDF
Oracle ADF Architecture TV - Development - Performance & Tuning
PPTX
Ed presents JSF 2.2 and WebSocket to Gameduell.
PPT
2007 Zend Con Mvc Edited Irmantas
PDF
Oracle ADF Architecture TV - Design - Advanced ADF Task Flow Concepts
PDF
Oracle ADF Architecture TV - Development - Error Handling
PPTX
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Reactive Java EE - Let Me Count the Ways!
Oracle ADF Architecture TV - Deployment - System Topologies
Anatomy of Autoconfig in Oracle E-Business Suite
Oracle ADF Architecture TV - Development - Version Control
Oracle ADF Architecture TV - Planning & Getting Started - Team, Skills and D...
Oracle ADF Architecture TV - Design - Task Flow Transaction Options
Oracle ADF Architecture TV - Design - Designing for Internationalization
Oracle ADF Architecture TV - Development - Logging
All of the Performance Tuning Features in Oracle SQL Developer
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Native REST Web Services with Oracle 11g
Extending Zend_Tool
Organinzing Your PHP Projects (2010 Memphis PHP)
Oracle ADF Architecture TV - Development - Performance & Tuning
Ed presents JSF 2.2 and WebSocket to Gameduell.
2007 Zend Con Mvc Edited Irmantas
Oracle ADF Architecture TV - Design - Advanced ADF Task Flow Concepts
Oracle ADF Architecture TV - Development - Error Handling
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Ad

Similar to Building and managing applications fast for IBM i (20)

PDF
Integrating PHP With System-i using Web Services
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
PPT
Lamp Zend Security
PPTX
High performance PHP: Scaling and getting the most out of your infrastructure
PPT
In Act Developers Platform
PPT
PPTX
Sst hackathon express
PDF
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
PDF
Stored-Procedures-Presentation
PPTX
php[world] Magento101
PPTX
My Saminar On Php
ODP
Application development using Zend Framework
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
PDF
sveltekit-en.pdf
PPTX
Crime Reporting System.pptx
ODP
Scaling PHP Applications with Zend Platform
PDF
Sydney mule soft meetup #8 1 August 2019 - all slides
PDF
2013 - Dustin whittle - Escalando PHP en la vida real
PPT
Edp bootstrapping a-software_company
Integrating PHP With System-i using Web Services
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Lamp Zend Security
High performance PHP: Scaling and getting the most out of your infrastructure
In Act Developers Platform
Sst hackathon express
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Stored-Procedures-Presentation
php[world] Magento101
My Saminar On Php
Application development using Zend Framework
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
sveltekit-en.pdf
Crime Reporting System.pptx
Scaling PHP Applications with Zend Platform
Sydney mule soft meetup #8 1 August 2019 - all slides
2013 - Dustin whittle - Escalando PHP en la vida real
Edp bootstrapping a-software_company
Ad

More from Zend by Rogue Wave Software (20)

PDF
Develop microservices in php
PPTX
Speed and security for your PHP application
PDF
Building web APIs in PHP with Zend Expressive
PPTX
To PHP 7 and beyond
PDF
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
PDF
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
PDF
Develop web APIs in PHP using middleware with Expressive (Code Europe)
PDF
Middleware web APIs in PHP 7.x
PPTX
Ongoing management of your PHP 7 application
PDF
Developing web APIs using middleware in PHP 7
PDF
The Docker development template for PHP
PDF
The most exciting features of PHP 7.1
PPTX
Unit testing for project managers
PDF
The new features of PHP 7
PPTX
Deploying PHP apps on the cloud
PPTX
Data is dead. Long live data!
PPTX
Optimizing performance
PPTX
Resolving problems & high availability
PPTX
Developing apps faster
PPTX
Keeping up with PHP
Develop microservices in php
Speed and security for your PHP application
Building web APIs in PHP with Zend Expressive
To PHP 7 and beyond
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
Develop web APIs in PHP using middleware with Expressive (Code Europe)
Middleware web APIs in PHP 7.x
Ongoing management of your PHP 7 application
Developing web APIs using middleware in PHP 7
The Docker development template for PHP
The most exciting features of PHP 7.1
Unit testing for project managers
The new features of PHP 7
Deploying PHP apps on the cloud
Data is dead. Long live data!
Optimizing performance
Resolving problems & high availability
Developing apps faster
Keeping up with PHP

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Cost to Outsource Software Development in 2025
PDF
Autodesk AutoCAD Crack Free Download 2025
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Cost to Outsource Software Development in 2025
Autodesk AutoCAD Crack Free Download 2025
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Reimagine Home Health with the Power of Agentic AI​
Design an Analysis of Algorithms I-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Salesforce Agentforce AI Implementation.pdf
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
L1 - Introduction to python Backend.pptx
Monitoring Stack: Grafana, Loki & Promtail
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Operating system designcfffgfgggggggvggggggggg
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Why Generative AI is the Future of Content, Code & Creativity?
AutoCAD Professional Crack 2025 With License Key
Navsoft: AI-Powered Business Solutions & Custom Software Development
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...

Building and managing applications fast for IBM i

  • 1. 1© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 2. 2© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Frameworks – a path to faster development • Language considerations • Run-time performance • Application development • Application deployment • Application management • Q & A
  • 3. 3© 2018 Rogue Wave Software, Inc. All Rights Reserved. • A number of topics in this presentation are related to, or available from, Zend Server. • It is important to understand what Zend Server is • Zend Server is a complete and certified PHP distribution stack • In addition to the PHP engine, installation of Zend Server provides an application for managing various aspects of the PHP application stack including: – Monitoring – Performance – Security – Applications NOTE: This is not intended to be a Zend Server webinar; however, aspects of Zend Server as related to performance will be highlighted.
  • 4. 4© 2018 Rogue Wave Software, Inc. All Rights Reserved. Watch the full webinar on-demand now
  • 5. 5© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 6. 6© 2018 Rogue Wave Software, Inc. All Rights Reserved. • A framework can be viewed as an application model that is customized by an application developer to satisfy a particular requirement • Frameworks provide a rich set of components for commonly invoked tasks – Includes simple interfaces and logic structures for accessing those libraries • Frameworks contain source code for solving particular problems with a particular discipline – Provides a set of APIs (function calls) that an be used to ivoke specific functionality with the framework
  • 7. 7© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Frameworks help development teams to concentrate on the specific requirements that they are trying to satisfy without having to expend valuable time and energy to design and implement the low-level common functions required by the application • Development projects can be completed faster since not all of the code is being developed from scratch • Provides reusable, maintainable, and well-organized code • Frameworks offer libraries and ready-to-use components – no need to reinvent the wheel for each new project • Once a framework is mastered, applications can be developed faster because the framework provides a structured way to approach the development project • A framework provides pre-written common application logic
  • 8. 8© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Implements PSR-7 (HTTP message interfaces) – PSR stands for PHP Standard Recommendation – in the case of PSR-7, the standard defines common interfaces for representing HTTP messages and URIs for use when communicating through PHP • Expressive is a PSR-7 implementation as well as a middleware library built on top of the implementation • Expressive is an alternative to Zend Framework as it provides a departure from the HTTP abstraction present in Zend Framework • Expressive is middleware in that it is code that exists between the request and the response – Expressive provides capability to take incoming requests, perform actions based on the request, and either complete the response or pass delegation on to the next middleware in the queue
  • 9. 9© 2018 Rogue Wave Software, Inc. All Rights Reserved. // In public/index.php: use ZendDiactorosResponse; use ZendDiactorosServer; use ZendStratigilityMiddlewareNotFoundHandler; use ZendStratigilityMiddlewarePipe; use function ZendStratigilitymiddleware; use function ZendStratigilitypath; require __DIR__ . '/../vendor/autoload.php'; $app = new MiddlewarePipe(); $server = Server::createServer([$app, 'handle'], $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES); // Landing page $app->pipe(middleware(function ($req, $handler) { if (! in_array($req->getUri()->getPath(), ['/', ''], true)) { return $handler->handle($req); } $response = new Response(); $response->getBody()->write('Hello world!'); return $response; })); // Another page $app->pipe(path('/foo', middleware(function ($req, $handler) { $response = new Response(); $response->getBody()->write('FOO!'); return $response; }))); // 404 handler $app->pipe(new NotFoundHandler(function () { return new Response(); })); $server->listen(function ($req, $res) { return $res; });
  • 10. 10© 2018 Rogue Wave Software, Inc. All Rights Reserved. • The code snipit provides two examples of middleware • The first is landing page – Listens at the root path – If the request path is empty or / then the middleware completes the response • If the request is not an empty path or a / then control is delegated to the next middleware in the stack • The second middleware matches on the path /foo (or will match /foo, or /foo/) as well as any path beneath /foo – If the path matches /foo than the response is provided as it's own message • If the path is not the root path or the /foo path than a '404 status' is composed
  • 11. 11© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Zend Framework is an implementation of the Model View Controller (MVC) architecture. • Expressive is middleware that is often simpiler to get developers up and running with. • Zend Framework requires developers to start learning about dependency injection and event system before then can even approach writing a controller. • Middleware such as Expressive can help to get develoeprs started more quickly, as an example: $app->get('/hello', function($request) { return new TextResponse('Hello, world'); })
  • 12. 12© 2018 Rogue Wave Software, Inc. All Rights Reserved.  • Streamline SQL requests: – Request: SQL statement – Action: • Check for/establish database connection • Execute SQL statement – Response: • Success/failure indication • Data-set (if SQL statement was a select statement) • Streamline ILE artifact requests: – Request: ILE artifact – Action: • Build-up XMLToolkit call based on request type and optional data • Execute XMLToolkit via XMLService – Response: • Success/failure indication • Data set (if ILE action results in data)
  • 13. 13© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 14. 14© 2018 Rogue Wave Software, Inc. All Rights Reserved. • The db2_connect() and db2_pconnect() statements are used in PHP scripts on IBM i to establish a connection to the IBM DB2 database. – The db2_pconnect() function establishes a persistent connection to database – when a db2_close() is encountered on a persistent connection, the underlying DB2 client connection remains open to serve the next matching db2_pconnect() request • The ibm_db2 extension can be configured to treat all db2_connect() calls as db2_pconnect() calls
  • 15. 15© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Optimizations to the Zend Engine significantly enhances performance • Performance gains ranging from 20-70% have been seen in real-world applications – No application code changes required!
  • 16. 16© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 17. 17© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Three types in PHP: – OpCache: Improves PHP performance by storing precompiled script bytecode in shared memory – this reduces the need for the PHP engine to parse scripts on each request. – Data Cache: – Page Cache: A cache is a collection of duplicate data where the original data is expensive to fetch or compute relative to the cache.
  • 18. 18© 2018 Rogue Wave Software, Inc. All Rights Reserved. • OPcache has a number of functions for working with and managing the cache. • Two functions of particular note: – opcache_compile_file  This function can be used to compile a php script without executing it. A typical usage of this function is to prime the cache after a web server restart – opcache_is_script_cached  This function returns an indication as to whether a script is cached or not. Typically used to detect the warming of the cache for a particular script More information on the OPCache functions ccan be found on php.net http://php.net/manual/en/ref.opcache.php
  • 19. 19© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Data Cache is a component of Zend Server that provides a set of PHP functions to improve performance. • Different data types can be stored in the cache including strings, arrays, and objects. • Items can be stored in shared memory or disk • Cached objects can be grouped together in namespaces. • Data Cache is typically used when it is impracticle to cache the entire page (see page caching) – One example would be a form that includes credit card numbers, social security numbers, and other personal privileged information (PPI) that you don't want stored in a cache Information on working with the data cache can be found at: http://files.zend.com/help/Zend- Server/content/working_with_the_data_cache.htm
  • 20. 20© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Page Cache is a component of Zend Server and is used to improve application performance by caching the entire output of a PHP script – It is important to note that Page Cache does not mitigate the dynamic capability of a PHP generated page – the dynamic capability is maintained through a rules system. • Use of Page Cache does not require any change to the underlying PHP code. • As a best practice, pages should be cached when their content is stable and does not require frequent changes. More information on page cache can be found at: http://files.zend.com/help/Zend- Server/content/page_cache_concept.htm?Highlight=page%20cache
  • 21. 21© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Pages to cache are defined via rules within the page caching function:
  • 22. 22© 2018 Rogue Wave Software, Inc. All Rights Reserved. A number of factors will affect the effectiveness of the cache including number of page request, frequency of data updates on the page, cache life, etc.
  • 23. 23© 2018 Rogue Wave Software, Inc. All Rights Reserved. • The Dashboard provides information that can be useful both as an indication of the performance of various aspects of the application stack as well as indicating potential bottlenecks
  • 24. 24© 2018 Rogue Wave Software, Inc. All Rights Reserved. Watch the full webinar on-demand now
  • 25. 25© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Information available on the dashboard: – Overview  shows information such as events, requests per second, and average response time. Note that the information displayed can be at the overall PHP engine level or at the application level – System Health  shows the number of events (segmented as notice, critical, and warning) as well as a breakdown of the processing to show where time is being spent (i.e., output, database, network, disk, php) – System Utilization  utilization metrics for active users, cpu usage, and average memory usage – Usage Statics  breakdown by browsers, operating system, and geographic location of requesters
  • 26. 26© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Information available on the dashboard: – Mobile Usage  breakdown of operating system distribution and mobile vs. desktop requests – Mobile Statistics  shows requests per second and processing breakdown by output, database, network, disk, and php The "Statistics Charts" page from the Zend Server documentation can be a good place to get more information on the statistical information available on the dashboard: http://files.zend.com/help/Zend- Server/content/zend_statistics_charts.htm
  • 27. 27© 2018 Rogue Wave Software, Inc. All Rights Reserved. • The ability to monitor the PHP runtime environment, and more importantly be able to take action based on events can be instrumental to ensuring optimal performance of PHP applications • A number of monitoring related functions are available: Function Description URL Insight View detailed reports and information on specific requests for PHP pages located on the web server. Events Displays events encountered/detected by Zend Server. An event is runtime-related information collected by the Monitor component. Events are triggered based on the monitoring rules. Event Rules Used to display and generate the Event rules that trigger events.
  • 28. 28© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Event Rules are used to define: – Events to monitor – Thresholds to trigger the event – Actions to take when an event is triggered
  • 29. 29© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 30. 30© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Application Management in Zend Server supports a number of key functions including: – Initial Deployment – Update – Redeployment – Rollback – Removal • Application installation, whether it is performed manually or through the application packaging has three broad steps: In a clustered environment applications can be deployed to multiple nodes in the cluster at the same time!
  • 31. 31© 2018 Rogue Wave Software, Inc. All Rights Reserved. • The ability to deploy an application (not to be confused with defining an application which I'll talk about shortly) requires an application package • The application package contains: – Data (application files, deployment scripts) – Scripts (commands/steps to follow for deployment, rollback, remove) – XML descriptor file (information needed to deploy the application using the Zend Server deployment feature)Application deployment can shorten the time it takes for actions such as the deployment, redeployment, and update of applications by streamlining the steps required and automating the process. Example: A set of PHP demo scripts that shows the db2 function calls and XMLToolkit exploitation on IBM i is delivered as a deployment package
  • 32. 32© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 33. 33© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Z-Ray is a development tool that provides insight into the details of a page request. • The Z-Ray toolbar is injected into the response from the PHP application and shown in the browser: • Z-Ray provides application insight without having to change the development workflow. Summary Information for Z-Ray: http://www.zend.com/en/products/s erver/z-ray
  • 34. 34© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Information available in Z-Ray includes
  • 35. 35© 2018 Rogue Wave Software, Inc. All Rights Reserved. Backtrace information as well as IDE actions are available!
  • 36. 36© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 37. 37© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 38. 38© 2018 Rogue Wave Software, Inc. All Rights Reserved. • While Z-Ray is most often used in development, it can also be used in production to isolate and identify run- time issues – By default Z-Ray is disabled in production – Selective mode provides for the definition of constraints for Z- Ray including time, URL, and browser address
  • 39. 39© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Imagine the following scenario: – Customer has implemented the open source moodle application • Moodle is a Learning Platform or Course Management System (CMS) • When the customer updated to the latest version of Moodle they were seeing significant performance issues (frankly, the application was unusable) • See Next Slides for how using Z-Ray quickly identified the issue:
  • 40. 40© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Step 1: Enable Z-Ray in selective mode for the application • Step 2: From a Web Browser, make a request to the moodle URL • Step 3: When the Z-Ray tool-bar is displayed review the execution time information: 34.72 ms 78% 128.64 ms 21% 2.10 ms 1% 0.00 ms ~0%
  • 41. 41© 2018 Rogue Wave Software, Inc. All Rights Reserved. • Step 4: Review Database Queries: – Step 4a: Sort on the 'Time' field to bring the longest running database statement to the top • Sort showed that the longest running SQL statement was the database connection statement – Investigation of that issue showed A DNS issue within the customer's environment The use of Z-Ray identified the issue within a matter of minutes – the customer had previously spent days trying to isolate the issue!!
  • 42. 42© 2018 Rogue Wave Software, Inc. All Rights Reserved. Watch the full webinar on-demand now
  • 43. 43© 2018 Rogue Wave Software, Inc. All Rights Reserved.
  • 44. 44© 2018 Rogue Wave Software, Inc. All Rights Reserved. zend.com/downloads Try Zend Server for IBM i
  • 45. 45© 2018 Rogue Wave Software, Inc. All Rights Reserved.