Using PHP to Build a Mobile Internet Platform

Similar documents
A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Investor Newsletter. Storage Made Easy Cloud Appliance High Availability Options WHAT IS THE CLOUD APPLIANCE?

Understanding Evolution's Architecture A Technical Overview

TECHNOLOGY WHITE PAPER Jun 2012

Web Frameworks. web development done right. Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.

BASICS OF SCALING: LOAD BALANCERS

Developers Integration Lab (DIL) System Architecture, Version 1.0

Testing & Assuring Mobile End User Experience Before Production. Neotys

CS 188/219. Scalable Internet Services Andrew Mutz October 8, 2015

Large-Scale Web Applications

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

Open Source Development with the Elastic Path Ecommerce Platform

LOAD BALANCING TECHNIQUES FOR RELEASE 11i AND RELEASE 12 E-BUSINESS ENVIRONMENTS

Smartphone Enterprise Application Integration

SwiftScale: Technical Approach Document

Accelerating Wordpress for Pagerank and Profit

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

TFE listener architecture. Matt Klein, Staff Software Engineer Twitter Front End

Architecting for the cloud designing for scalability in cloud-based applications

GeoCloud Project Report USGS/EROS Spatial Data Warehouse Project

WELCOME TO Open Source Enterprise Architecture

SaaS-Based Employee Benefits Enrollment System

10 Best Practices for Application Performance Testing

The Benefits of Verio Virtual Private Servers (VPS) Verio Virtual Private Server (VPS) CONTENTS

Application Performance Testing Basics

How To Write A Monitoring System For Free

WEB SERVICES FOR MOBILE COMPUTING

Delivering IaaS for the Greek Academic and Research Community

TECHNOLOGY WHITE PAPER Jan 2016

Zend Platform TM. White Paper: Zend Download Server. By Zend Technologies, Inc. May Zend Technologies, Inc. All rights reserved.

Reference Model for Cloud Applications CONSIDERATIONS FOR SW VENDORS BUILDING A SAAS SOLUTION

CUMULUX WHICH CLOUD PLATFORM IS RIGHT FOR YOU? COMPARING CLOUD PLATFORMS. Review Business and Technology Series

MENDIX FOR MOBILE APP DEVELOPMENT WHITE PAPER

Apache Jakarta Tomcat

Introduction to IBM Worklight Mobile Platform

HOSTING PYTHON WEB APPLICATIONS. Graham Dumpleton PyCon Australia Sydney 2011

TESTING AND OPTIMIZING WEB APPLICATION S PERFORMANCE AQA CASE STUDY

Scalability of web applications. CSCI 470: Web Science Keith Vertanen

Zend and IBM: Bringing the power of PHP applications to the enterprise

Using Cloud Services for Building Next Generation Mobile Apps

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

How To Create A Cloud Based System For Aaas (Networking)

Develop PHP mobile apps with Zend Framework

USE OF PYTHON AS A SATELLITE OPERATIONS AND TESTING AUTOMATION LANGUAGE

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Drupal Performance Tuning

Building Multi-Site & Ultra-Large Scale Cloud with Openstack Cascading

White Paper: Deploying QlikView

KEMP LoadMaster. Enabling Hybrid Cloud Solutions in Microsoft Azure

Layers of Caching: Key to scaling your website. Lance Albertson -- Narayan Newton

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

PHP on IBM i: What s New with Zend Server 5 for IBM i

Real World Considerations for Implementing Desktop Virtualization

CloudCenter Full Lifecycle Management. An application-defined approach to deploying and managing applications in any datacenter or cloud environment

PHP and MongoDB Web Development Beginners Guide by Rubayeet Islam

Using Ruby on Rails for Web Development. Introduction Guide to Ruby on Rails: An extensive roundup of 100 Ultimate Resources

ios Hybrid Mobile Application Development

Oracle Application Server 4.0: The Integration Platform for Oracle Products and the Internet. An Oracle White Paper August 1998

Click to edit Master title style. Click to edit Master text styles. Hedley Aylott. CEO Summit

Information Technology Services Classification Level Range C Reports to. Manager ITS Infrastructure Effective Date June 29 th, 2015 Position Summary

Web Cloud Architecture

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

A Tool for Evaluation and Optimization of Web Application Performance

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Oracle9i Application Server: Options for Running Active Server Pages. An Oracle White Paper July 2001

Module 12: Microsoft Windows 2000 Clustering. Contents Overview 1 Clustering Business Scenarios 2 Testing Tools 4 Lab Scenario 6 Review 8

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

Building Scalable Applications Using Microsoft Technologies

Learning GlassFish for Tomcat Users

WEBLOGIC ADMINISTRATION

Cloud Based Application Architectures using Smart Computing

HA for Enterprise Clouds: Oracle Solaris Cluster & OpenStack

IERG 4080 Building Scalable Internet-based Services

Virtualization Technologies and Blackboard: The Future of Blackboard Software on Multi-Core Technologies

Project Convergence: Integrating Data Grids and Compute Grids. Eugene Steinberg, CTO Grid Dynamics May, 2008

3-Tier Architecture. 3-Tier Architecture. Prepared By. Channu Kambalyal. Page 1 of 19

ENTERPRISE MOBILE BACKEND AS A SERVICE EVALUATION CHECKLIST

Building and Deploying Enterprise M2M Applications with Axeda Platform

Open-Xchange Whitepaper Open-Xchange Server 6 Architecture Overview

Application Note. Cacti monitoring. Document version: v1.0 Last update: 8th November 2013

Service Oriented Architectures

APPLICATION NOTE. Elastic Scalability. for HetNet Deployment, Management & Optimization

Application Whitelisting - Extend your Security Arsenal? Mike Baldi Cyber Security Architect Honeywell Process Solutions

An Oracle White Paper May Oracle Tuxedo: An Enterprise Platform for Dynamic Languages

Common Server Setups For Your Web Application - Part II

OPENIAM ACCESS MANAGER. Web Access Management made Easy

Outlook. Corporate Research and Technologies, Munich, Germany. 20 th May 2010

Using Redis as a Cache Backend in Magento

Chapter -5 SCALABILITY AND AVAILABILITY

Evidence based performance tuning of

WINDOWS AZURE EXECUTION MODELS

Cloud computing - Architecting in the cloud

Wednesday, October 10, 12. Running a High Performance LAMP stack on a $20 Virtual Server

How To Run A Cloud Server On A Server Farm (Cloud)

A Unified Messaging-Based Architectural Pattern for Building Scalable Enterprise Service Bus

Leveraging the power of social media & mobile applications

Lecture 02a Cloud Computing I

Distributed Database Access in the LHC Computing Grid with CORAL

Oracle Database Security and Audit

Transcription:

Using PHP to Build a Mobile Internet Platform Florian Hoenig <florian@kargo.com> Copyright 2008, Kargo Global, Inc. All rights reserved 1

Overview 1. About Kargo 2. PHP beyond Hypertext Preprocessing 3. Kargo s Mobile Web Architecture 4. Conclusions 5. Ideas & Discussion 2

Who is Kargo? Kargo is a mobile media company that conceives, builds and manages leading mobile products for media properties. 1. Mobile Web 2. Web Applications with Mobile Integration 3. Messaging Applications 4. Native Applications (J2ME, iphone, Blackberry, etc.) 3

Mobile Web 4

Web/Messaging 5

Panoramic Applications Web Apps Mobile Content & Apps Widget Messaging Text BOB12 to 85555 to get content 6

Technical Challenges Many thousands of variations of devices from over 40 vendors to target Devices vary strongly in terms of capabilities (and bugs!) Network speeds very strongly Crippled technology standards (business-driven removal of features). Misleading specifications. Significant amount of engineering and operational time spent on compensating for the above. 7

How to address? Need for a flexible architecture Loosely coupled (web-) technology helps Single choice of technology PHP! 8

PHP beyond Hypertext Preprocessing building enterprise architectures with PHP5 and Zend Framework 9

Enterprise Architecture From Microsoft.com:...a methodology to encompass all of the various IT aspects and processes into a single practice. From MIT:... IT infrastructure reflecting the integration and standardization requirements of the firm s operating model. In simple words: A single practice to reflect what the company does 10

Qualitative Requirements flexibility - platform s potential to address new business requirements rapid development - reuse, simplicity, short learning curves performance - write efficient apps should be straight forward reliability - robust platforms, solid testing, security interoperability - offer simple ways to talk to interface with third-party systems simple deployment - application installation and update scalability - architectures must scale on demand high availability - be able to guarantee uptime manageable costs - ability to budget 11

Qualitative Requirements flexibility - platform s potential to address new business requirements rapid development - reuse, simplicity, short learning curves performance - write efficient apps should be straight forward reliability - robust platforms, solid testing, security interoperability - offer simple ways to talk to interface with third-party systems simple deployment - application installation and update scalability - architectures must scale on demand high availability - be able to guarantee uptime manageable costs - ability to budget How to address with PHP? 11

Motivation and Claim Scripting languages (e.g. Python, Ruby) continue to grow in popularity for many applications where PHP is usually not considered. PHP is ready to do the same 12

Legacy and Evolution <?php <?php if (!isset($_post[ item ])) include form.inc ; else {?> <html><body> <?php $quantity = $_POST['quantity']; $item = $_POST['item']; /** * @category Kargo * @package Smpp * @subpackage Client * @copyright Copyright (c) 2008 Kargo Global, Inc. */ abstract class Kargo_Smpp_Client_Abstract extends Kargo_Event_Buffered_Client implements Kargo_Event_Buffered_Handler { /** * The smpp connection state * * @var unknown_type */ protected $_state = KARGO_SMPP_STATE_CLOSED; echo "You ordered ". $quantity. " ". $item. ".<br / >"; echo "Thank you for ordering from <b>myshop</b>!";?> </body></html> <?php }?>... } /** * SMPP protocol flavor to use * * @var string */ protected $_smsc_vendor = Kargo_Smpp::KARGO_SMPP_VENDOR_NONE; Two random code snippets. PHP looks quite different nowadays. But, is it ready for Enterprise environments? -------------- <?php $esmc = new Kargo_Smpp_Client_MBlox($options); $esmc->connect(): Kargo_Event::enable($esmc); Kargo_Event::dispatchLoop(); 13

Zend Framework Already offers several enterprise grade features, principles and practices for web development Has roadmap for much more. Highly active community that you can plan with. Could be foundation to take PHP on the market for general purpose application development à la Java,.Net, C++. Read more at: http://framework.zend.com/about/overview 14

How to address with PHP? Zend Framework Already offers several enterprise grade features, principles and practices for web development Has roadmap for much more. Highly active community that you can plan with. Could be foundation to take PHP on the market for general purpose application development à la Java,.Net, C++. Read more at: http://framework.zend.com/about/overview 14

Considerations for building your architecture using ZF/PHP 1. Identify architectural layers of your environment Use PHP traditionally on the front end Consider using PHP-CLI for back-end services 2. Maintain your own class framework Adapt from ZF: best practices, coding standards, testing standards, etc. Really solid - no need to re-invent Be ready to patch ZF components, without waiting for next release 3. Manage your PHP configuration choose your extensions carefully optionally write your own extensions when needed 15

More Considerations for building your architecture using ZF/PHP 4. Avoid using PEAR lack of consistency not as enterprise-friendly as ZF (license) 5. Avoid tying yourself to a particular system environment don t let the environment dictate your application design 6. Avoid using tightly-coupled PHP frameworks ( CMSs ) Often very restrictive and hard to extend or integrate with other systems 16

What s missing? Multi-threading A more concrete life-cycle model for long running processes However: not a huge sacrifice 17

Kargo s Mobile Application Platform 18

Kargo s Architecture: Logical Overview Application Layer Mobile Web Applications Web Applications Public Web Services Foundation Classes Messaging Service Billing Subsystem Device Management Reporting Engine Digital Asset Manager Service Layer Persistence Layer Database Nodes Shared FS 19

Kargo s Architecture: Product Overview Kargo Framework Zend Framework plus mobile specific Kargo class library. Basis for all other products Karpet Fever Kamp Kellner Kargo DAM Kargo Platform Feed-based mobile magazine application with community features. Abstracts mobile specifics. Mobile downloadable content and application storefront application, with cross-carrier billing Web-based mobile messaging application. Allows for editorial content and costumer interaction. Mobile Messaging Application Server. Unified programming model, across all messaging protocols. Digital Asset Management System. Offers a document-oriented database concept for content. The core business logic application server. Handles subscriber management, device detection, reporting, ad serving, etc. All front-end applications use this as their back-end. 20

The Kargo Framework Zend Framework offers a lot already, but here is what we had to do ourselves: Kargo_Daemon - toolkit for forking, shared objects, IPC, etc. Kargo_Dam - wrapper classes for our digital asset management system Kargo_Db - additions to Zend_Db_Adapter, supporting fail-over and load-balancing. Kargo_Event - wrappers for our libevent extension for asynchronous socket programming. Kargo_Mime - a full and flexible MIME implementation to use beyond Mail. Kargo_Mm7 - a full MM7 6.8.0 protocol implementation. Kargo_Platform - controller plug-ins for interaction with platform services Kargo_Service - a set of Zend_Service style third-party web-service wrappers for our partners. Kargo_Smpp - implementation for OpenMarket, SinglePoint, mblox and Standard SMPP v3.4. Kargo_WebDav - a webdav implementation 21

Example: Approach for the Mobile Web Architecture Problem: Classical web server models are sub-optimal for a lot of new applications. Usually solved with lots of workarounds, mostly incorporating caching techniques on many levels. Solution: Cleanly decouple front-end logic from core services and let the back-end be a stateful application. This is common is Java-based architectures, but never seen in pure PHP. 22

Example: Mobile Web Architecture Apache/PHP5 node 1 Apache/PHP5 node 2 Karpet Instance Karpet Instance... Zend_XmlRpc Backend Node 1 Backend Node 2 Backend Node 3 Platform Server PHP-CLI Platform Server PHP-CLI Platform Server PHP-CLI... ext/libevent ext/libevent ext/libevent Platform server is a stateful application using asynchronous http handling 23

What s going on (simplified) Karpet Instance Platform Server PHP-CLI Message Server PHP-CLI 1: first request 2: start session (headers) return: device, user, carrier, etc. 3: write session 4: another request... 5: sign up [sends text message to user] 6: sendsms()... 24

How it works 1. Setup Db, logger, etc. only on startup 2. Start Http server with it s socket being monitored by the underlying event notification system 3. On an incoming http request, the handlerequest callback is triggered, serving the xml rpc request Platform Server (simplified) PHP-CLI class PlatformServer implements Kargo_Event_Http_Handler { private $_rpc_server;... public function construct() { // 1) setup db connection // 2) setup instance of Zend_XmlRpc_Server and add the service classes } public function handlerequest(kargo_event_http_request $r) { $request = new Kargo_XmlRpc_Request_Event($r); $this->_rpc_server->setrequest($request); return $this->server->handle(); } } Kargo_Event::init(); Now we can keep our back-end services running stateful $server = new Kargo_Event_Http_Server($options, new PlatformServer); $server->enable(); Kargo_Event::dispatch(); Kargo s libevent PHP extension OS Kernel notification layer (KQueue, epoll, etc) 25

Performance Baseline: Apache/mod_php5, pre-fork, no opcode cache Setup: PHP 5.2.6 on Macbook Pro/OS X (KQueue) with libevent 1.4.5 and Zend Framework 1.5 Concurrency level: 50 requests Apache: Mean requests per second: 8.76 Kargo (one process): Mean requests per second: 450.82 26

Pros Incredible speedup Low CPU and memory utilization Surprisingly stable (runs for months now under heavy loads) No need for memcached, opcode cache, db connections pooling, or similar techniques. Back-end applications are now stateful. Allows for lazy loading, better task scheduling, etc. Lot s of database queries can be kept in memory. 27

Cons Developers have to be more aware of memory management Some people call it abuse of PHP, since it ignores the request based PHP execution cycle. Garbage collection a request tear-down is not called. Doesn t work well with Zend_Controller_Front, because of extensive cyclic referencing (memory leaks) 28

However Current server does not leak memory. Near Future: PHP 5.3 adds control over the garbage collector, which adds additional support for this scenario. 29

Conclusions Use of Zend Framework and it s principles opens paths into solid software architectures. Using PHP as a general purpose programming language has shown to be surprisingly fast and robust in a production environment. Kargo has successfully replaced Java-typical application servers with PHP, leaving a pure single choice of technology across all tiers. Kargo has build an enterprise-grade architecture, simple and flexible enough to react to the complex requirement in the mobile domain. 30

/dev/random How about building an app server which passes Zend_Controller_Request objects to a pool of worked? How about a restricted ZF app server similar to Google App Engine, running on Amazon EC2? 31

Thank You! florian@kargo.com text FH to 99799 32