Pros and cons of the inproc development model, Inproc management: a walk-through – Pitney Bowes MapXtreme User Manual

Page 108

Advertising
background image

Chapter 6: Understanding State Management

InProc Development Model

MapXtreme v7.1

108

Developer Guide

You might find it helpful to think of a web application as being analogous to a restaurant. Web
applications need to service simultaneous requests from multiple users, just as restaurants need
waiters to take food orders from multiple tables.

The InProc model is analogous to a restaurant that hires one waiter per table. It would be expensive
for a restaurant to employ one waiter per table. However, if a restaurant was able to afford hiring one
waiter per table, then doing so would certainly provide each table with excellent service. Also, having
one waiter per table would make each waiter's job simpler. Since each individual waiter would be
servicing one table, the waiter would not need to waste any time or energy remembering which order
went to which table.

Pros and Cons of the InProc Development Model

If you choose the InProc model, it will be easier for you to write your web application, because you
will not need to provide any complex code for saving and restoring each user's state with each
subsequent request.

However, the InProc model is not scalable, because it requires having a dedicated MapXtreme
Session for each concurrent user. For thousands of users to use your site concurrently, the
application would need to maintain thousands of MapXtreme sessions on the server, which taxes
your server’s resources. If you anticipate a large number of concurrent users, then the InProc model
is not an appropriate choice for your application.

InProc Management: A Walk-Through

An example helps illustrate how MapXtreme Sessions are created and used when an application
uses the InProc model. The following describes, in simplified terms, the sequence of events:

1. A user launches a browser and goes to your mapping application web site.

2. A new MapXtreme Session is created on your server. It will be used to service all requests from

this user during this ASP.NET session.

3. The workspace file(s) specified in your Web.config file is loaded. As a result, your MapXtreme

Session's MapFactory has one or more Map objects. For the sake of this example, let us assume
that the workspace contains one map, which initially shows the entire world.

4. The web page's HTML is rendered and returned to the client browser. Part of the page is an

HTML img tag, which requests an image of the map from the server. On the server, objects from
this user's MapXtreme Session—a Map object, in particular—are used to render the map image,
which is returned to the user's browser.

5. The user selects the Zoom In tool, and then draws a marquee box around Australia, to zoom in

on Australia.

6. On the server, the application modifies the Map object's Zoom property so that it is zoomed into

Australia. The application renders a new map image and streams the image to the client
browser.
The Map object is now in a different state than it was initially-its Center and Zoom properties
have changed (to show Australia rather than showing the entire world).

Advertising