Multitheaded Service Applications: Charlotte Powerbuilder Conference

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Charlotte PowerBuilder Conference

Moving at the Speed of Change May 2015

Multitheaded Service
Applications
For PowerBuilder Classic!
Powered by Sponsored by
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Based on Actual Production Implementations!


By Chris Pollach – President: Software Tool & Die Inc.
Ottawa, Canada

• Email: cpollach@travel-net.com
• Blog: http://chrispollach.blogspot.ca
• PBDJ: http://chrispollach.sys-con.com
• LinkedIn: http://ca.linkedin.com/in/chrispollach
• SourceForge: http://sourceforge.net/projects/stdfndclass
• TaeKwonDo: http://www.syeoh.com

Maximizing your PowerBuilder Application Horsepower!


2
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
Approach:

Automated: OCR + Redact + Audit Trail


The Problem
- 75 Form types
- Number format
- Image Quality
-Millions images!

PCI – Payment Card Industry Compliance 3


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Volumetrics! 4
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

5
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
Redaction Work Queue
Production
Archive 1
Imag
Worker
Redaction RWQ DBServices
ing
OCR Worker#1 Database Trigger

Archive 1 Update * Archive


1-48 Segment1
worker Ima
ging
Qualifier
Redaction * Archive IM1
OCR IM1
Threads Worker#2 Segment2 IM1
* Archive IM1
Archive 1 All Archives Segment3 C.I.
processed Database
Ima Sequentially
ging Redaction (217
OCR Worker#nn * Archive Terabytes)
Seg . 99+
Solution … Multithreading (48 workers => 6 months) CI-2

1 Worker = 4-5 Years! Update PCI Repository


6
Original
Credit Card DataBase
Information
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
DB Services
C.I. Database
Database ICWQ
Image_ID 12M-14M!
Archive_DB_Nam
App_Form e
Image
DML Table_Name
Bitmap
...

Supporting
Doc_Image
Bitmap * Av: => 849,787
Image Image
Photo Conversion MagicK
Image
Worker
JPEG * Av: 76,159

Signature
Image
JPEG

Candidate for Multithreading!


DEC

7
Image
Charlotte PowerBuilder Conference
Windows Service
(Main Thread)
Queue Manager

Moving at the Speed of Change Queue May 2015


4 ID 3 4
GCMS 1
W SubThread
S S S Windows Thread ...
P RQ Table P S Inbound
Windows Thread
Table P S Inbound
5 (Request) Inbound
Worker
Request-1
Msg + XML Table P
5 Request-2 (Transaction)
5
Request-3 Request Datum (Transaction)
Worker
Request-4 ...
Worker
...
SubThread Request-5
2
Windows Thread
Outbound
...
MQ 6
Windows Thread
Outbound
(Message ) Worker Msg-1
Outbound
(Message ) Worker
5 Msg-2
(MessageXML
) Worker 6
Msg-3
7
Msg-4
Msg-5
... Table
7 TR + ePPS F.R.
S 8 SP
GCMS WIP Database IEC
Folder P
Clean

Another candidate for Multithreading! 8


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

9
Charlotte PowerBuilder Conference
O/S Moving at theM SpeedCommon
Service of Change
Modules May 2015
Sub-
MainThread Start,Stop,Query ...
Thread
Process,Quiesce
SubThread * Activate ...

M Connectivity,Pooling
Database Trans. Mgnt ...
HTTP/HTTPS
Connectivity, Encryption, Web
WebService Security ... Service
NetTCP
Windows Trapping, Controlled,
ErrorHandler Shutdown, Continue, Stop
Service ... Debug
File
Application Log Event, File, Database
O/S
Debug ...
(* included both Main
Thread and Sub- SMTP, SMS, MAPI Text Msg
Notification ...
Threads
implementation) Run, O/S Feature O/S App.
PowerShell ...

Parsing, Schema
XML Validation, Escapement ...

Query, Stop

10
Console Report ...

Format, Parameter parsing,


Message Date Time stamping ...
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
Common Classes
Class Construction!
Base Layer
BASE

Abstract Layers

ABSTRACT

Thread Message Notification ... XML

MainThread SubThread

Concrete Layer
In/Out In/Out As Required
MainThread SubThread As Required
As Required

Windows Service Application(s) 11


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Main Thread Class Access Privilege Sub Thread Class


Window/CVUO Window/CVUO
Window/CVUO NVUO
NVUO Window/CVUO
NVUO NVUO

Thread Interaction 12
Charlotte PowerBuilder Conference
Moving atMAIN
the Thread
Speed of Change May 2015
Sleep (no work)
Application Method (Handle, SUB-Thread(s)
(Main Thread) Alive? Parameters)
StartThread (#nn) Real Process
StopThread (#nn) Sub-Thread Main
ProcessQueue (QID) Method Sub-Thread Process Process
Handler #01 Process
GetStatus (#nn) (Completion Code, #01
Parameters)
Config Real Main Process
Handler Array [ ]
Sub-Thread
Sub-Thread Process Process
Handler #02 Process
#02

Real Main Process


Sub-Thread
Sub-Thread Process Process
Handler #03 Process
#03

... Alive? ...


Real Main Process
Sub-Thread
Sub-Thread Process Process
Handler #nn Process
#nn

Implementation
Legend
- No wait method calls (posted)
13
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Processor

Affinity (0) In/Out bound Processor0


Sub-Thread 1

Affinity (1) In/Out bound Processor1


Sub-Thread 2

In/Out bound Processor2


Affinity (2) Sub-Thread 3

Affinity (3) In/Out bound Processor3


Sub-Thread 4

Load Distribution! 14
MS-Windows based server * - “best performance”
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Stability
CPU
Load

Memory

Designing for 24/7 operations! 15


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Server #1 Statsus
Server #2
Table

PCI PCI
Controller TCP/IP Controller

Used TCP/IP Peer-to-Peer


PCI
Controller ?Distributed PowerBuilder?

Server #3
Multiple Servers 16
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
Main Thread Console
Consoles!

Sub-thread Console

17
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
Main Thread Alert

Sub-thread Alert

eMail Alerts! 18
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

• Both PowerBuilder Classic and PB.Net do not support an


MS-Windows Service console application like Visual
Studio.
• Must employ 3rd party tools in order to transpose a PB
application into an MS-Windows Service.
• Many commercial & open source software tools for MS-
Windows Service support.

MS-Windows Service Dilemma. 19


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015
• Service Runner (open source - $0)
• N.S.S.M. (open source - $0)
• FireDaemon (commercial - $49)
• AlwaysUp (commercial - $49)
• Application as Service (commercial - $79)
• Turbo Service Manager (open source - $0)
• Winserv (open source - $0)
• Launcher Service (open source - $0)
• PBNIServ (commercial - $250) [PB only]

Service software for PowerBuilder! 20


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Multithreaded Frameworks Details


• http://sourceforge.net/projects/stdfndclass
• Free
• Open Source
• Examples
• Documentation
• Support

All systems mentioned built from … 21


Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Questions?

Q&A Session 22
Charlotte PowerBuilder Conference
Moving at the Speed of Change May 2015

Have you hugged your DataWindow today? 23

You might also like