EWD 3 Training Course Part 35: QEWD Session Locking

R
Rob TweedIT Consultant, Developer & Director/Founder at M/Gateway Developments Ltd
Copyright © 2016 M/Gateway Developments Ltd
EWD 3 Training Course
Part 35
QEWD Session Locking
Rob Tweed
Director, M/Gateway Developments Ltd
Twitter: @rtweed
Copyright © 2016 M/Gateway Developments Ltd
QEWD Sessions
• QEWD uses the ewd-session module to provide
its Session functionality
• QEWD Session data is physically stored in your
embedded Global Storage database:
– Redis, Cache or GT.M
– Uses the DocumentStore / DocumentNode
abstraction
• All Worker processes have access to the
Session document in your Global storage
– So it doesn't matter which physical worker process
handles each requst for the same Session
Copyright © 2016 M/Gateway Developments Ltd
QEWD Sessions
• There's nothing to stop a browser / client
from sending 2 simultaneous requests to
QEWD
– If this happens, the one that arrives first at the
QEWD back-end will be dispatched to the first
available worker process
– The second request will probably be next in
the queue, and if there's another available
worker process, the second request will be
dispatched to it
Copyright © 2016 M/Gateway Developments Ltd
QEWD Sessions
• So it's possible to have two Worker
processes handling requests from the
same client and for the same QEWD
Session
• If the handler functions for these requests
modify the QEWD Session contents,
there's a risk of data corruption if they both
access / change the same Session data at
the same time
Copyright © 2016 M/Gateway Developments Ltd
QEWD Session Locking
• To prevent this happening, you can
optionally enable Session Locking.
• In this mode, the first Worker locks the
Session document for the QEWD Session
it's handling
• The second Worker tries to do the same,
but can't set the lock, so it waits
– Remember QEWD uses synchronous APIs,
so the second worker process blocks
Copyright © 2016 M/Gateway Developments Ltd
QEWD Session Locking
• When the first Worker finishes processing (by
invoking the finished() function), it releases the
Session lock
• The second Worker can now set the lock and
commence processing
– It releases the lock again when it finishes
• Note that other workers processing requests for
other Sessions won't be affected
– They will be locking/unlocking different Sessions
Copyright © 2016 M/Gateway Developments Ltd
QEWD Session Locking
• Session locking therefore forces processing of
simultaneously sent requests from the same
browser / client to be serialised
– ie requests for a specific QEWD Session will only be
handled one at a time
• Note that QEWD will process them in the order it
received them
– If you need them to be processed in a specific order, you'll need
to control the sequence within the browser / client yourself
Copyright © 2016 M/Gateway Developments Ltd
Enabling Session Locking
• Simple change to your QEWD startup file
• Add the lockSession property to the config
object
• Set its value to true
Copyright © 2016 M/Gateway Developments Ltd
Edit your QEWD Startup File
var config = {
managementPassword: 'keepThisSecret!',
serverName: 'My QEWD Server',
port: 8080,
poolSize: 2,
database: {
type: 'cache',
params: {
path: 'c:InterSystemsCache2015-2mgr’
},
lockSession: true
}
};
var qewd = require('qewd').master;
qewd.start(config);
Copyright © 2016 M/Gateway Developments Ltd
Restart QEWD
• Session locking is now enabled
1 of 10

Recommended

EWD 3 Training Course Part 12: QEWD Session Timeout Control by
EWD 3 Training Course Part 12: QEWD Session Timeout ControlEWD 3 Training Course Part 12: QEWD Session Timeout Control
EWD 3 Training Course Part 12: QEWD Session Timeout ControlRob Tweed
561 views8 slides
EWD 3 Training Course Part 29: Running QEWD as a Service by
EWD 3 Training Course Part 29: Running QEWD as a ServiceEWD 3 Training Course Part 29: Running QEWD as a Service
EWD 3 Training Course Part 29: Running QEWD as a ServiceRob Tweed
1K views25 slides
EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started by
EWD 3 Training Course Part 6: What Happens when a QEWD Application is StartedEWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
EWD 3 Training Course Part 6: What Happens when a QEWD Application is StartedRob Tweed
1K views17 slides
EWD 3 Training Course Part 3: Summary of EWD 3 Modules by
EWD 3 Training Course Part 3: Summary of EWD 3 ModulesEWD 3 Training Course Part 3: Summary of EWD 3 Modules
EWD 3 Training Course Part 3: Summary of EWD 3 ModulesRob Tweed
979 views23 slides
EWD 3 Training Course Part 19: The cache.node APIs by
EWD 3 Training Course Part 19: The cache.node APIsEWD 3 Training Course Part 19: The cache.node APIs
EWD 3 Training Course Part 19: The cache.node APIsRob Tweed
905 views50 slides
EWD 3 Training Course Part 8: Anatomy of the QEWD Messaging Cycle by
EWD 3 Training Course Part 8: Anatomy of the QEWD Messaging CycleEWD 3 Training Course Part 8: Anatomy of the QEWD Messaging Cycle
EWD 3 Training Course Part 8: Anatomy of the QEWD Messaging CycleRob Tweed
720 views20 slides

More Related Content

What's hot

EWD 3 Training Course Part 42: The QEWD Docker Appliance by
EWD 3 Training Course Part 42: The QEWD Docker ApplianceEWD 3 Training Course Part 42: The QEWD Docker Appliance
EWD 3 Training Course Part 42: The QEWD Docker ApplianceRob Tweed
1.3K views73 slides
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres... by
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...Rob Tweed
1.1K views53 slides
EWD 3 Training Course Part 30: Modularising QEWD Applications by
EWD 3 Training Course Part 30: Modularising QEWD ApplicationsEWD 3 Training Course Part 30: Modularising QEWD Applications
EWD 3 Training Course Part 30: Modularising QEWD ApplicationsRob Tweed
1.1K views85 slides
EWD 3 Training Course Part 27: The QEWD Session by
EWD 3 Training Course Part 27: The QEWD SessionEWD 3 Training Course Part 27: The QEWD Session
EWD 3 Training Course Part 27: The QEWD SessionRob Tweed
920 views9 slides
EWD 3 Training Course Part 5a: First Steps in Building a QEWD Application by
EWD 3 Training Course Part 5a: First Steps in Building a QEWD ApplicationEWD 3 Training Course Part 5a: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5a: First Steps in Building a QEWD ApplicationRob Tweed
1.4K views33 slides
EWD 3 Training Course Part 7: Applying the QEWD Messaging Pattern by
EWD 3 Training Course Part 7: Applying the QEWD Messaging PatternEWD 3 Training Course Part 7: Applying the QEWD Messaging Pattern
EWD 3 Training Course Part 7: Applying the QEWD Messaging PatternRob Tweed
1.3K views51 slides

What's hot(20)

EWD 3 Training Course Part 42: The QEWD Docker Appliance by Rob Tweed
EWD 3 Training Course Part 42: The QEWD Docker ApplianceEWD 3 Training Course Part 42: The QEWD Docker Appliance
EWD 3 Training Course Part 42: The QEWD Docker Appliance
Rob Tweed1.3K views
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres... by Rob Tweed
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...
EWD 3 Training Course Part 37: Building a React.js application with ewd-xpres...
Rob Tweed1.1K views
EWD 3 Training Course Part 30: Modularising QEWD Applications by Rob Tweed
EWD 3 Training Course Part 30: Modularising QEWD ApplicationsEWD 3 Training Course Part 30: Modularising QEWD Applications
EWD 3 Training Course Part 30: Modularising QEWD Applications
Rob Tweed1.1K views
EWD 3 Training Course Part 27: The QEWD Session by Rob Tweed
EWD 3 Training Course Part 27: The QEWD SessionEWD 3 Training Course Part 27: The QEWD Session
EWD 3 Training Course Part 27: The QEWD Session
Rob Tweed920 views
EWD 3 Training Course Part 5a: First Steps in Building a QEWD Application by Rob Tweed
EWD 3 Training Course Part 5a: First Steps in Building a QEWD ApplicationEWD 3 Training Course Part 5a: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5a: First Steps in Building a QEWD Application
Rob Tweed1.4K views
EWD 3 Training Course Part 7: Applying the QEWD Messaging Pattern by Rob Tweed
EWD 3 Training Course Part 7: Applying the QEWD Messaging PatternEWD 3 Training Course Part 7: Applying the QEWD Messaging Pattern
EWD 3 Training Course Part 7: Applying the QEWD Messaging Pattern
Rob Tweed1.3K views
EWD 3 Training Course Part 16: QEWD Services by Rob Tweed
EWD 3 Training Course Part 16: QEWD ServicesEWD 3 Training Course Part 16: QEWD Services
EWD 3 Training Course Part 16: QEWD Services
Rob Tweed671 views
EWD 3 Training Course Part 31: Using QEWD for Web and REST Services by Rob Tweed
EWD 3 Training Course Part 31: Using QEWD for Web and REST ServicesEWD 3 Training Course Part 31: Using QEWD for Web and REST Services
EWD 3 Training Course Part 31: Using QEWD for Web and REST Services
Rob Tweed3.3K views
EWD 3 Training Course Part 34: QEWD Resilient Mode by Rob Tweed
EWD 3 Training Course Part 34: QEWD Resilient ModeEWD 3 Training Course Part 34: QEWD Resilient Mode
EWD 3 Training Course Part 34: QEWD Resilient Mode
Rob Tweed750 views
EWD 3 Training Course Part 4: Installing & Configuring QEWD by Rob Tweed
EWD 3 Training Course Part 4: Installing & Configuring QEWDEWD 3 Training Course Part 4: Installing & Configuring QEWD
EWD 3 Training Course Part 4: Installing & Configuring QEWD
Rob Tweed2.9K views
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality by Rob Tweed
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService FunctionalityEWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
Rob Tweed2.1K views
EWD 3 Training Course Part 11: Handling Errors in QEWD by Rob Tweed
EWD 3 Training Course Part 11: Handling Errors in QEWDEWD 3 Training Course Part 11: Handling Errors in QEWD
EWD 3 Training Course Part 11: Handling Errors in QEWD
Rob Tweed639 views
EWD 3 Training Course Part 5b: First Steps in Building a QEWD Application by Rob Tweed
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationEWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
Rob Tweed999 views
EWD 3 Training Course Part 2: EWD 3 Overview by Rob Tweed
EWD 3 Training Course Part 2: EWD 3 OverviewEWD 3 Training Course Part 2: EWD 3 Overview
EWD 3 Training Course Part 2: EWD 3 Overview
Rob Tweed2.1K views
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap... by Rob Tweed
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
EWD 3 Training Course Part 36: Accessing REST and Web Services from a QEWD ap...
Rob Tweed932 views
EWD 3 Training Course Part 44: Creating MicroServices with QEWD.js by Rob Tweed
EWD 3 Training Course Part 44: Creating MicroServices with QEWD.jsEWD 3 Training Course Part 44: Creating MicroServices with QEWD.js
EWD 3 Training Course Part 44: Creating MicroServices with QEWD.js
Rob Tweed1.5K views
EWD 3 Training Course Part 10: QEWD Sessions and User Authentication by Rob Tweed
EWD 3 Training Course Part 10: QEWD Sessions and User AuthenticationEWD 3 Training Course Part 10: QEWD Sessions and User Authentication
EWD 3 Training Course Part 10: QEWD Sessions and User Authentication
Rob Tweed999 views
qewd-ripple: The Ripple OSI Middle Tier by Rob Tweed
qewd-ripple: The Ripple OSI Middle Tierqewd-ripple: The Ripple OSI Middle Tier
qewd-ripple: The Ripple OSI Middle Tier
Rob Tweed720 views
QEWD.js, JSON Web Tokens & MicroServices by Rob Tweed
QEWD.js, JSON Web Tokens & MicroServicesQEWD.js, JSON Web Tokens & MicroServices
QEWD.js, JSON Web Tokens & MicroServices
Rob Tweed903 views
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data... by Rob Tweed
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...
Rob Tweed3.9K views

Viewers also liked

EWD 3 Training Course Part 33: Configuring QEWD to use CORS by
EWD 3 Training Course Part 33: Configuring QEWD to use CORSEWD 3 Training Course Part 33: Configuring QEWD to use CORS
EWD 3 Training Course Part 33: Configuring QEWD to use CORSRob Tweed
1.1K views5 slides
EWD 3 Training Course Part 26: Event-driven Indexing by
EWD 3 Training Course Part 26: Event-driven IndexingEWD 3 Training Course Part 26: Event-driven Indexing
EWD 3 Training Course Part 26: Event-driven IndexingRob Tweed
678 views14 slides
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5 by
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5Rob Tweed
621 views73 slides
EWD 3 Training Course Part 17: Introduction to Global Storage Databases by
EWD 3 Training Course Part 17: Introduction to Global Storage DatabasesEWD 3 Training Course Part 17: Introduction to Global Storage Databases
EWD 3 Training Course Part 17: Introduction to Global Storage DatabasesRob Tweed
1.3K views35 slides
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD by
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWDEWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWDRob Tweed
541 views5 slides
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ... by
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...Rob Tweed
805 views14 slides

Viewers also liked(14)

EWD 3 Training Course Part 33: Configuring QEWD to use CORS by Rob Tweed
EWD 3 Training Course Part 33: Configuring QEWD to use CORSEWD 3 Training Course Part 33: Configuring QEWD to use CORS
EWD 3 Training Course Part 33: Configuring QEWD to use CORS
Rob Tweed1.1K views
EWD 3 Training Course Part 26: Event-driven Indexing by Rob Tweed
EWD 3 Training Course Part 26: Event-driven IndexingEWD 3 Training Course Part 26: Event-driven Indexing
EWD 3 Training Course Part 26: Event-driven Indexing
Rob Tweed678 views
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5 by Rob Tweed
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5
EWD 3 Training Course Part 41: Building a React.js application with QEWD, Part 5
Rob Tweed621 views
EWD 3 Training Course Part 17: Introduction to Global Storage Databases by Rob Tweed
EWD 3 Training Course Part 17: Introduction to Global Storage DatabasesEWD 3 Training Course Part 17: Introduction to Global Storage Databases
EWD 3 Training Course Part 17: Introduction to Global Storage Databases
Rob Tweed1.3K views
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD by Rob Tweed
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWDEWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD
Rob Tweed541 views
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ... by Rob Tweed
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
EWD 3 Training Course Part 13: Putting Everything so far into Practice using ...
Rob Tweed805 views
EWD 3 Training Course Part 18: Modelling NoSQL Databases using Global Storage by Rob Tweed
EWD 3 Training Course Part 18: Modelling NoSQL Databases using Global StorageEWD 3 Training Course Part 18: Modelling NoSQL Databases using Global Storage
EWD 3 Training Course Part 18: Modelling NoSQL Databases using Global Storage
Rob Tweed1.2K views
EWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes by Rob Tweed
EWD 3 Training Course Part 24: Traversing a Document's Leaf NodesEWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes
EWD 3 Training Course Part 24: Traversing a Document's Leaf Nodes
Rob Tweed622 views
EWD 3 Training Course Part 25: Document Database Capabilities by Rob Tweed
EWD 3 Training Course Part 25: Document Database CapabilitiesEWD 3 Training Course Part 25: Document Database Capabilities
EWD 3 Training Course Part 25: Document Database Capabilities
Rob Tweed905 views
EWD 3 Training Course Part 21: Persistent JavaScript Objects by Rob Tweed
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsEWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript Objects
Rob Tweed779 views
EWD 3 Training Course Part 20: The DocumentNode Object by Rob Tweed
EWD 3 Training Course Part 20: The DocumentNode ObjectEWD 3 Training Course Part 20: The DocumentNode Object
EWD 3 Training Course Part 20: The DocumentNode Object
Rob Tweed1K views
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4 by Rob Tweed
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 4
Rob Tweed718 views
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3 by Rob Tweed
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
Rob Tweed627 views
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects by Rob Tweed
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsEWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
Rob Tweed732 views

Similar to EWD 3 Training Course Part 35: QEWD Session Locking

WebLogic Stability; Detect and Analyse Stuck Threads by
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsMaarten Smeets
3.9K views49 slides
11 bpm by
11 bpm11 bpm
11 bpmashish61_scs
262 views16 slides
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI... by
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...C2B2 Consulting
7.2K views35 slides
Give your little scripts big wings: Using cron in the cloud with Amazon Simp... by
Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...Amazon Web Services
6.4K views30 slides
Con8780 nair rac_best_practices_final_without_12_2content by
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentAnil Nair
412 views47 slides
SnapDiff performance issue by
SnapDiff performance issueSnapDiff performance issue
SnapDiff performance issueAshwin Pawar
331 views2 slides

Similar to EWD 3 Training Course Part 35: QEWD Session Locking(20)

WebLogic Stability; Detect and Analyse Stuck Threads by Maarten Smeets
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck Threads
Maarten Smeets3.9K views
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI... by C2B2 Consulting
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...
Oracle SOA Suite Performance Tuning- UKOUG Application Server & Middleware SI...
C2B2 Consulting7.2K views
Give your little scripts big wings: Using cron in the cloud with Amazon Simp... by Amazon Web Services
Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
Amazon Web Services6.4K views
Con8780 nair rac_best_practices_final_without_12_2content by Anil Nair
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
Anil Nair412 views
SnapDiff performance issue by Ashwin Pawar
SnapDiff performance issueSnapDiff performance issue
SnapDiff performance issue
Ashwin Pawar331 views
The Functions of the Operating System by andyr91
The Functions of the Operating SystemThe Functions of the Operating System
The Functions of the Operating System
andyr9199 views
IBM MQ High Availabillity and Disaster Recovery (2017 version) by MarkTaylorIBM
IBM MQ High Availabillity and Disaster Recovery (2017 version)IBM MQ High Availabillity and Disaster Recovery (2017 version)
IBM MQ High Availabillity and Disaster Recovery (2017 version)
MarkTaylorIBM2K views
IBM MQ Disaster Recovery by MarkTaylorIBM
IBM MQ Disaster RecoveryIBM MQ Disaster Recovery
IBM MQ Disaster Recovery
MarkTaylorIBM8.7K views
[Hanoi-August 13] Tech Talk on Caching Solutions by ITviec
[Hanoi-August 13] Tech Talk on Caching Solutions[Hanoi-August 13] Tech Talk on Caching Solutions
[Hanoi-August 13] Tech Talk on Caching Solutions
ITviec2.6K views
Managing your exchange architecture by Veeam Software
Managing your exchange architectureManaging your exchange architecture
Managing your exchange architecture
Veeam Software920 views
(ATS4-PLAT08) Server Pool Management by BIOVIA
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management
BIOVIA664 views
Step by Step - Reusing old features to build new ones by Allon Mureinik
Step by Step - Reusing old features to build new onesStep by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new ones
Allon Mureinik1.3K views
GWAVACon 2015: Microsoft MVP - Exchange Server Migrations & Updates by GWAVA
GWAVACon 2015: Microsoft MVP - Exchange Server Migrations & UpdatesGWAVACon 2015: Microsoft MVP - Exchange Server Migrations & Updates
GWAVACon 2015: Microsoft MVP - Exchange Server Migrations & Updates
GWAVA 525 views

More from Rob Tweed

QEWD Update by
QEWD UpdateQEWD Update
QEWD UpdateRob Tweed
945 views32 slides
Data Persistence as a Language Feature by
Data Persistence as a Language FeatureData Persistence as a Language Feature
Data Persistence as a Language FeatureRob Tweed
1.3K views108 slides
LNUG: Having Your Node.js Cake and Eating It Too by
LNUG: Having Your Node.js Cake and Eating It TooLNUG: Having Your Node.js Cake and Eating It Too
LNUG: Having Your Node.js Cake and Eating It TooRob Tweed
2.8K views81 slides
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services by
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesEWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesRob Tweed
891 views93 slides
QEWD.js: Have your Node.js Cake and Eat It Too by
QEWD.js: Have your Node.js Cake and Eat It TooQEWD.js: Have your Node.js Cake and Eat It Too
QEWD.js: Have your Node.js Cake and Eat It TooRob Tweed
628 views76 slides
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services by
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Servicesewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST ServicesRob Tweed
333 views37 slides

More from Rob Tweed(8)

QEWD Update by Rob Tweed
QEWD UpdateQEWD Update
QEWD Update
Rob Tweed945 views
Data Persistence as a Language Feature by Rob Tweed
Data Persistence as a Language FeatureData Persistence as a Language Feature
Data Persistence as a Language Feature
Rob Tweed1.3K views
LNUG: Having Your Node.js Cake and Eating It Too by Rob Tweed
LNUG: Having Your Node.js Cake and Eating It TooLNUG: Having Your Node.js Cake and Eating It Too
LNUG: Having Your Node.js Cake and Eating It Too
Rob Tweed2.8K views
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services by Rob Tweed
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST ServicesEWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Rob Tweed891 views
QEWD.js: Have your Node.js Cake and Eat It Too by Rob Tweed
QEWD.js: Have your Node.js Cake and Eat It TooQEWD.js: Have your Node.js Cake and Eat It Too
QEWD.js: Have your Node.js Cake and Eat It Too
Rob Tweed628 views
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services by Rob Tweed
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Servicesewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
ewd-qoper8-vistarpc: Exposing VistA's RPCs as REST Services
Rob Tweed333 views
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2 by Rob Tweed
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
Rob Tweed597 views
EWD 3 Training Course Part 23: Traversing a Range using DocumentNode Objects by Rob Tweed
EWD 3 Training Course Part 23: Traversing a Range using DocumentNode ObjectsEWD 3 Training Course Part 23: Traversing a Range using DocumentNode Objects
EWD 3 Training Course Part 23: Traversing a Range using DocumentNode Objects
Rob Tweed797 views

Recently uploaded

WebAssembly by
WebAssemblyWebAssembly
WebAssemblyJens Siebert
51 views18 slides
Keep by
KeepKeep
KeepGeniusee
77 views10 slides
Programming Field by
Programming FieldProgramming Field
Programming Fieldthehardtechnology
5 views9 slides
Short_Story_PPT.pdf by
Short_Story_PPT.pdfShort_Story_PPT.pdf
Short_Story_PPT.pdfutkarshsatishkumarsh
5 views16 slides
Introduction to Maven by
Introduction to MavenIntroduction to Maven
Introduction to MavenJohn Valentino
6 views10 slides
Bootstrapping vs Venture Capital.pptx by
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptxZeljko Svedic
12 views17 slides

Recently uploaded(20)

Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic12 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 views
Sprint 226 by ManageIQ
Sprint 226Sprint 226
Sprint 226
ManageIQ5 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta6 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... by sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik7 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri860 views

EWD 3 Training Course Part 35: QEWD Session Locking

  • 1. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Training Course Part 35 QEWD Session Locking Rob Tweed Director, M/Gateway Developments Ltd Twitter: @rtweed
  • 2. Copyright © 2016 M/Gateway Developments Ltd QEWD Sessions • QEWD uses the ewd-session module to provide its Session functionality • QEWD Session data is physically stored in your embedded Global Storage database: – Redis, Cache or GT.M – Uses the DocumentStore / DocumentNode abstraction • All Worker processes have access to the Session document in your Global storage – So it doesn't matter which physical worker process handles each requst for the same Session
  • 3. Copyright © 2016 M/Gateway Developments Ltd QEWD Sessions • There's nothing to stop a browser / client from sending 2 simultaneous requests to QEWD – If this happens, the one that arrives first at the QEWD back-end will be dispatched to the first available worker process – The second request will probably be next in the queue, and if there's another available worker process, the second request will be dispatched to it
  • 4. Copyright © 2016 M/Gateway Developments Ltd QEWD Sessions • So it's possible to have two Worker processes handling requests from the same client and for the same QEWD Session • If the handler functions for these requests modify the QEWD Session contents, there's a risk of data corruption if they both access / change the same Session data at the same time
  • 5. Copyright © 2016 M/Gateway Developments Ltd QEWD Session Locking • To prevent this happening, you can optionally enable Session Locking. • In this mode, the first Worker locks the Session document for the QEWD Session it's handling • The second Worker tries to do the same, but can't set the lock, so it waits – Remember QEWD uses synchronous APIs, so the second worker process blocks
  • 6. Copyright © 2016 M/Gateway Developments Ltd QEWD Session Locking • When the first Worker finishes processing (by invoking the finished() function), it releases the Session lock • The second Worker can now set the lock and commence processing – It releases the lock again when it finishes • Note that other workers processing requests for other Sessions won't be affected – They will be locking/unlocking different Sessions
  • 7. Copyright © 2016 M/Gateway Developments Ltd QEWD Session Locking • Session locking therefore forces processing of simultaneously sent requests from the same browser / client to be serialised – ie requests for a specific QEWD Session will only be handled one at a time • Note that QEWD will process them in the order it received them – If you need them to be processed in a specific order, you'll need to control the sequence within the browser / client yourself
  • 8. Copyright © 2016 M/Gateway Developments Ltd Enabling Session Locking • Simple change to your QEWD startup file • Add the lockSession property to the config object • Set its value to true
  • 9. Copyright © 2016 M/Gateway Developments Ltd Edit your QEWD Startup File var config = { managementPassword: 'keepThisSecret!', serverName: 'My QEWD Server', port: 8080, poolSize: 2, database: { type: 'cache', params: { path: 'c:InterSystemsCache2015-2mgr’ }, lockSession: true } }; var qewd = require('qewd').master; qewd.start(config);
  • 10. Copyright © 2016 M/Gateway Developments Ltd Restart QEWD • Session locking is now enabled