Session State Management

adhocjackpotΑσφάλεια

5 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

99 εμφανίσεις

Windows Azure

Session State Management


Carlos Sardo

Senior Professional
Developer

Tam
Tam

www.tamtam.nl

@
TamTamNL

carlos.sardo@tamtam.nl

http://nl.linkedin.com/in/carlossardo

High level stuff you already know

Web Roles

Worker Roles

Table Storage

Blob Storage

SQL Azure

What

is
session

state
?



Session

state

is

usually

used

to

store

and

retrieve

values

for

a

user

across

ASP
.
NET

pages

in

a

web

application
.

There

are

four

available

modes

to

store

session

values

in

ASP
.
NET
:



In
-
Proc
,

which

stores

session

state

in

the

individual

web

server’s

memory
.

This

is

the

default

option

if

a

particular

mode

is

not

explicitly

specified
.



State

Server,

which

stores

session

state

in

another

process,

called

ASP
.
NET

state

service
.



SQL

Server,

which

stores

session

state

in

a

SQL

Server

database



Custom,

which

lets

you

choose

a

custom

storage

provider
.

In
-
Proc

session mode does not work
in Windows
Azure



Managing session state in
Windows
Azure: What are the options?


Table Storage

SQL Azure

Table Storage


Store

each

session

in

a

record
.


Each

record

will

have

an

expiration

column

that

describe

the

expired

time

of

each

session

if

there’s

no

interaction

from

the

user
.


Low

Cost!

$
0
.
14

per

GB

per

month

for

storage

capacity

and

$
0
.
01

per

10
,
000

storage

transactions
.


Performance

tradeoff


May

not

perform

as

fast

as

the

other

options
:

SQL

Azure,

AppFabric

Cache

.


Table Storage

Get
the resources:
http://
code.msdn.microsoft.com/windowsazure/Windows
-
Azure
-
ASPNET
-
03d5dc14



Is

essentially

a

subset

of

SQL

Server
.

Just

a

few

modifications
!


Cost

effective,

especially

when

you

have

an

existing

SQL

Azure

database
.


It

requires

you

to

clean

the

expired

session

manually

by

calling

the

DeleteExpiredSessions


stored

procedure
.

(i
.
e
.:

WorkerRole
)


Microsoft

does

not

provide

any

official

support

for

this
.


SQL Azure

Get
the resources:
http://
blogs.msdn.com/b/sqlazure/archive/2010/08/04/10046103
.aspx


SQL Azure


It

provides

a

high
-
performance,

in
-
memory,

distributed

caching

service!


Accessing

RAM

is

much

faster

than

accessing

disk,

so

Windows

Azure

Caching

obviously

provides

the

highest

performance

access

of

all

the

available

options
.


It’s

officially

supported

by

Microsoft
.


Despite

its

advantages,

the

charge

of

Windows

Azure

Caching

is

relatively

high,

starting

from

$
45

per

month

for

128

MB,

all

the

way

up

to

$
325

per

month

for

4

GB
.


Get
the resources:
http://
blogs.msdn.com/b/danbuche/archive/2011/05/06/managin
g
-
asp
-
net
-
session
-
state
-
with
-
windows
-
azure
-
appfabric
-
cache.aspx


Update!


ASP.NET Universal Providers

http
://
www.hanselman.com/blog/IntroducingSystemWebProvider
sASPNETUniversalProvidersForSessionMembershipRolesAndUserP
rofileOnSQLCompactAndSQLAzure.aspx


Thanks!







www.tamtam.nl

@
TamTamNL

carlos.sardo@tamtam.nl

Want to
know more
about this?
Mail me.

Any Qs?
Get us on
Twitter

http://nl.linkedin.com/in/carlossardo

All artwork on this slide deck created by
Josh
Twist
. If you steal it please provide credit and a
link to
http://www.thejoyofcode.com/cloud_artwork.
aspx


Thanks!

http://acloudyplace.com/2012/02/managing
-
session
-
state
-
in
-
windows
-
azure
-
what
-
are
-
the
-
options
/



http://
www.hanselman.com/blog/IntroducingSystemWebP
rovidersASPNETUniversalProvidersForSessionMembers
hipRolesAndUserProfileOnSQLCompactAndSQLAzure.a
spx