Upload
kvamsi
View
3.604
Download
0
Tags:
Embed Size (px)
DESCRIPTION
NetScaler Web 2.0 Push technology scales Comet or Reverse Ajax applications that depend on long running idle client connections. It offloads server load by handling all the client connections on the NetScaler and publishing a REST API for the server application to send periodic updates.
Citation preview
Web 2.0 Push Technical overviewNetscaler Product Group
Web 2.0 - Server Push or Reverse Ajax
Reverse Ajax is the ability to push data from a web or app server to the browser, without user interaction"Publish-Subscribe" model
Clients subscribe to information channels/feedServers push “new” information out to the subscribers
Many different names and techniquesHTTP Server PushHTTP StreamingCOMET (Server Push + Long Polling)Long PollingBOSH (Bidirectional-streams Over Synchronous HTTP ) © The Coding Machine
Client Update: Three Common Techniques
Server PushClient Pull
Server Push – Two Common Techniques
ServerLong Polling
Req_1
Query finishes
Quiet period (y)
Query finishes
Req_2
Req_3
Client Server
Quiet period (y)
Streaming
t
t + y
t + 2y
Req
Chunk_1 (data)
Chunk_0 (data)
Quiet period
Client
Quiet period
Chunk_2 (data)
Time
Connection resource tied up
on Server
Connection resource tied up
on Server
NetScaler Web 2.0 Push: Offloading Connection Management
BenefitsImproves server utilization by 10xImproves application responsivenessCuts data center energy and cooling costs
AvailabilityAvailable in NetScaler 9.x – (March 2009)Available in Platinum and Enterprise editionRequires custom script development to adapt a given
application to work with our Push technology to enable tagging data streams as “Server Push-able”
Millions of clients
Few servers
NetScaler Web 2.0 Push: Asynchronous Connection Mgmt
• NetScaler acts as a full proxy between subscribers (persistent clients) and publishers (push servers)
• Parks millions of persistent client connections
• Enables configuration driven approach to identifying a client connection and server push setup – aka label
• Offloads client connection management from servers
• Reuses server connections thus improving server utilization and “push”es data to client based on returned label
• Enables all existing policy, availability and security services across asynchronous interaction
NetScaler Web 2.0 Push Message Flow
Step 1: Connection Setup
Step 2: Client Identification
Step 3: Connection Labeling
Step 4: Server Push
NetScaler Web 2.0 Push Building Blocks
Connection Labeling ProtocolReceive and terminate connections;
decrypt and analyze every request Setup transaction label over multiplexed
HTTP connections
Push Switching ProtocolNetScaler accepts asynchronous out of
band label updates over few TCP connections
NetScaler demultiplexes label and dispatches updates over persistent client connections
NetScaler Web 2.0 Push : An Example Setup
Server10.217.6.53:80
Push-VIP10.217.6.87:80
Client10.216.134.59
Client-VIP10.217.6.86:80
Server Push messages are sent to NetScaler over a few pooled connections
NetScaler Web 2.0 Push: HTTP Streaming Support
PUSH-VIP
LastChunk (data)
msg0
RES
DEFERABLE = Yes, Label = L1RES-HDR
GET
POST /client/L1 data0
Chunk_0 (data)
POST /client/L1 data1
Chunk_1 (data)
VIP
POST /client/L1 final
AppServer Messaging BusClient NetScaler PUSH_VIP: IP-Prt
NS_HDRGET Labeling protocolTransaction Labeled. TCP connection can be optionally closed
Quiet period. NS holding onto client connection.
Quiet period. NS holding onto client connection.
msg1
msg2
Quiet period. Waiting for next update.
Quiet period. Waiting for next update.
Request from Client (Browser) to NetScaler VIP Request from NetScaler to Server
Response from NetScaler VIP to Client (Browser)Response from Server to NetScaler
Connection Labeling ProtocolClient to Server
Server to Client
NetScaler Push UpdatesUpdate from Server to Push VIP using
REST API
Update forwarded to Client by NetScaler
Status Ack from NetScaler to Server in XML
Application code change for NetScaler Web 2.0 Push
def longpoll_update(np, pushvs, label): holdtime = 10 + random.randint(0,5) time.sleep(holdtime)
data = mesg % (label, holdtime) np.push_post_update(pushvs, label, data, True)
def process_request(): pushvs = os.environ.get('HTTP_NSPUSHVSERVER', '') if pushvs == '': print "Content-Type: text/html" print "" print "NetScaler PUSH functionality not enabled. " sys.exit()
np = nspush.NsPushMgr() label = np.push_label_client()
#daemonize this process, so the parent exits # and the long poll will send update later daemon.createDaemon()
longpoll_update(np, pushvs, label)
if __name__ == '__main__': process_request()
class NsPushMgr:
def push_label_client(self): label = str(int(time.time())) print "NSDEFERRABLE: YES" print "NSSERVERLABEL: ", label print "Content-Type: text/html" print "" return label
def push_post_update(self, pushvip, label, data, msg_end): pushvip = re.sub('_', ':', pushvip)
if msg_end is True: uri = '/CLIENT/V10/' + label + '?MSG_END=1' else: uri = '/CLIENT/V10/' + label + '?MSG_END=0'
conn = httplib.HTTPConnection(pushvip) conn.request('POST', uri, data, {}) resp = conn.getresponse() conn.close()
poll.py nspush.py