<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Lazy web sites run faster</title>
	<atom:link href="http://gojko.net/2008/04/07/lazy-web-sites-run-faster/feed/" rel="self" type="application/rss+xml" />
	<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/</link>
	<description>Building software that matters</description>
	<lastBuildDate>Thu, 02 Feb 2012 07:12:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: gojko</title>
		<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/comment-page-1/#comment-28033</link>
		<dc:creator>gojko</dc:creator>
		<pubDate>Tue, 27 May 2008 17:24:50 +0000</pubDate>
		<guid isPermaLink="false">http://gojko.net/2008/04/07/lazy-web-sites-run-faster/#comment-28033</guid>
		<description>Hi Hari,

the internet banking example you suggested is asynchronus by its nature, since two sites are involved in the workflow. I typically design web wallet payments so that the main merchant site starts a payment operation in the system, then the request returns back to the browser which polls the server for updates. when the backend server has sent all relevant details to the wallet and received back the request confirmation, it updates the transaction status to &quot;ready for redirect&quot;. Client app, in the browser, upon getting that status, reads the information required for redirection and forwards the user to the wallet web site. Upon completion, wallet forwards the user back to the payment status page, where the browser polls the server again periodically for status updates. The wallet system will also typically send the approval to the merchant server, which then updates the transaction status to &quot;complete&quot;. the workflow is a bit different for wallets that do not send backend-to-backend updates but that difference is not really important for this story.

I&#039;d organise the ticket example by reserving the ticket on your end, then sending off the payment request, and if that request succeeds then confirming the ticket reservation. If the payment fails, then releasing the ticket. Reserving a ticket would be a short atomic DB operation, so the concurrency of that would be controlled by the database (even if two reservation requests come at the same time, the DB will refuse one transaction or block it until the first one finishes). The speed of payment processing then does not matter.</description>
		<content:encoded><![CDATA[<p>Hi Hari,</p>
<p>the internet banking example you suggested is asynchronus by its nature, since two sites are involved in the workflow. I typically design web wallet payments so that the main merchant site starts a payment operation in the system, then the request returns back to the browser which polls the server for updates. when the backend server has sent all relevant details to the wallet and received back the request confirmation, it updates the transaction status to &#8220;ready for redirect&#8221;. Client app, in the browser, upon getting that status, reads the information required for redirection and forwards the user to the wallet web site. Upon completion, wallet forwards the user back to the payment status page, where the browser polls the server again periodically for status updates. The wallet system will also typically send the approval to the merchant server, which then updates the transaction status to &#8220;complete&#8221;. the workflow is a bit different for wallets that do not send backend-to-backend updates but that difference is not really important for this story.</p>
<p>I&#8217;d organise the ticket example by reserving the ticket on your end, then sending off the payment request, and if that request succeeds then confirming the ticket reservation. If the payment fails, then releasing the ticket. Reserving a ticket would be a short atomic DB operation, so the concurrency of that would be controlled by the database (even if two reservation requests come at the same time, the DB will refuse one transaction or block it until the first one finishes). The speed of payment processing then does not matter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hari</title>
		<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/comment-page-1/#comment-27916</link>
		<dc:creator>Hari</dc:creator>
		<pubDate>Fri, 23 May 2008 15:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://gojko.net/2008/04/07/lazy-web-sites-run-faster/#comment-27916</guid>
		<description>Hi gojko,

Your thoughts in this article is a very good aspect to be considered for architects designing their products. And it has been covered very well under 3 good ideas.

I have one question:

1) With regard to asynchronous processing, you have given the example of credit- card authentication. But in the case of payment using internet banking, how can we make it asynchronous? May be this is not an appropriate question, but can that process be made asynchronous?

Payment thru&#039; internet banking involves punching into the bank&#039;s site from the main shopping website, logging in with authentication, and processing of your card details and authentication of transaction password details.  

Related to the same topic, I can think of another example like flight booking. Say for example, there is just 1 ticket left for you to book, from Moscow to Chicago. You place an order, an order id is created (as you have given in your example), and the authentication process is delegated. In between the process of creating an order id, and authentication, there could be another thread (user request) which creates another order id for the same ticket. If the second thread is fast enough, the first user cannot get the ticket which is not a desirable situation. Also, there may be a case where the first user&#039;s money may have been debited, but ticket not issued, because the second user used a credit card (instead of internet banking) and his card processing ended sooner.

Isn&#039;t this whole transaction of booking atomic? Placing an order for a ticket and authentication of the process?

Or, would we allow only one order id to be created and maintained in the database at a time to avoid this situation?

Please let me know your thoughts.</description>
		<content:encoded><![CDATA[<p>Hi gojko,</p>
<p>Your thoughts in this article is a very good aspect to be considered for architects designing their products. And it has been covered very well under 3 good ideas.</p>
<p>I have one question:</p>
<p>1) With regard to asynchronous processing, you have given the example of credit- card authentication. But in the case of payment using internet banking, how can we make it asynchronous? May be this is not an appropriate question, but can that process be made asynchronous?</p>
<p>Payment thru&#8217; internet banking involves punching into the bank&#8217;s site from the main shopping website, logging in with authentication, and processing of your card details and authentication of transaction password details.  </p>
<p>Related to the same topic, I can think of another example like flight booking. Say for example, there is just 1 ticket left for you to book, from Moscow to Chicago. You place an order, an order id is created (as you have given in your example), and the authentication process is delegated. In between the process of creating an order id, and authentication, there could be another thread (user request) which creates another order id for the same ticket. If the second thread is fast enough, the first user cannot get the ticket which is not a desirable situation. Also, there may be a case where the first user&#8217;s money may have been debited, but ticket not issued, because the second user used a credit card (instead of internet banking) and his card processing ended sooner.</p>
<p>Isn&#8217;t this whole transaction of booking atomic? Placing an order for a ticket and authentication of the process?</p>
<p>Or, would we allow only one order id to be created and maintained in the database at a time to avoid this situation?</p>
<p>Please let me know your thoughts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/comment-page-1/#comment-27371</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Tue, 06 May 2008 03:15:09 +0000</pubDate>
		<guid isPermaLink="false">http://gojko.net/2008/04/07/lazy-web-sites-run-faster/#comment-27371</guid>
		<description>Thanks a lot for your feedback. Things are much clearer. My situation is already somewhat as you recommend.

My current server environment is as follows (3 servers):
- webserver running IIS and hosting the app components that invoke the long running TX
- DB server running SQL Server
- Another server (server X) which runs a third party software package that communicates to external systems. This is what processes the long running TXs. They are processed synchronously.
- App component on webserver sends request to server X which processes it and returns whenever it&#039;s done. App component then writes results to DB.

My goal is to keep the webserver as unburdened as possible and keep page response time relatively constant. To do that it appears that I&#039;ll have to implement browser &quot;are you done&quot; polling. The real work would be, and is, done on server X which calls external system but the app thread on the webserver would still be waiting synchronously for the response from server X.

I could probably wrap the long running TX on server X and invoke it asynchronously from the app on the web server but as the real work is being done on server X and not the webserver I&#039;m not sure if that would buy me much.</description>
		<content:encoded><![CDATA[<p>Thanks a lot for your feedback. Things are much clearer. My situation is already somewhat as you recommend.</p>
<p>My current server environment is as follows (3 servers):<br />
- webserver running IIS and hosting the app components that invoke the long running TX<br />
- DB server running SQL Server<br />
- Another server (server X) which runs a third party software package that communicates to external systems. This is what processes the long running TXs. They are processed synchronously.<br />
- App component on webserver sends request to server X which processes it and returns whenever it&#8217;s done. App component then writes results to DB.</p>
<p>My goal is to keep the webserver as unburdened as possible and keep page response time relatively constant. To do that it appears that I&#8217;ll have to implement browser &#8220;are you done&#8221; polling. The real work would be, and is, done on server X which calls external system but the app thread on the webserver would still be waiting synchronously for the response from server X.</p>
<p>I could probably wrap the long running TX on server X and invoke it asynchronously from the app on the web server but as the real work is being done on server X and not the webserver I&#8217;m not sure if that would buy me much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gojko</title>
		<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/comment-page-1/#comment-27361</link>
		<dc:creator>gojko</dc:creator>
		<pubDate>Mon, 05 May 2008 21:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://gojko.net/2008/04/07/lazy-web-sites-run-faster/#comment-27361</guid>
		<description>Hi Bob,

first of all, I would not execute the external request from the web server at all. Ideally, I&#039;d delegate that to another server. Depending on your server architecture (and whether you use a web server or an app server to process web requests), you might be able to launch background threads in the web server itself, but again the goal is to relieve the web servers from as much stress as we can - and delegate long running work to background operational servers.

Regarding the other part, it really depends on the external service. Some card processor run synchronously, some card processors send you a notification when the transaction has been authorised. (so typically you don&#039;t poll, they call you when the job is done).</description>
		<content:encoded><![CDATA[<p>Hi Bob,</p>
<p>first of all, I would not execute the external request from the web server at all. Ideally, I&#8217;d delegate that to another server. Depending on your server architecture (and whether you use a web server or an app server to process web requests), you might be able to launch background threads in the web server itself, but again the goal is to relieve the web servers from as much stress as we can &#8211; and delegate long running work to background operational servers.</p>
<p>Regarding the other part, it really depends on the external service. Some card processor run synchronously, some card processors send you a notification when the transaction has been authorised. (so typically you don&#8217;t poll, they call you when the job is done).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://gojko.net/2008/04/07/lazy-web-sites-run-faster/comment-page-1/#comment-27360</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Mon, 05 May 2008 21:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://gojko.net/2008/04/07/lazy-web-sites-run-faster/#comment-27360</guid>
		<description>I&#039;m almost there. I think I&#039;m missing just a small bit of the picture re the server to long-running external request processing.

Here&#039;s the situation:
1. browser sends request to webserver
2. app on webserver submits request to external system that may possibly take a while (let&#039;s say possibly 20-30 minutes). Have no control over the external system but have to account for it.
3. browser polls for a limited time (30 seconds) and after that displays a message telling user to check order status page and maybe redirects to some other page.

I guess my question has to do with the server thread that made the request of the long running external service and that has now been &#039;forgotten about&#039; by the browser.

1. Is the request from the server to external system typically synchronous or asynchronous?
-If sync, the server thread sits and waits.
-If async, then the server must be able to poll the external process for progress or the external process must provide some type of call back.
2. What is standard practice, if there is such a thing as standard? What do you see as the more common architecture?</description>
		<content:encoded><![CDATA[<p>I&#8217;m almost there. I think I&#8217;m missing just a small bit of the picture re the server to long-running external request processing.</p>
<p>Here&#8217;s the situation:<br />
1. browser sends request to webserver<br />
2. app on webserver submits request to external system that may possibly take a while (let&#8217;s say possibly 20-30 minutes). Have no control over the external system but have to account for it.<br />
3. browser polls for a limited time (30 seconds) and after that displays a message telling user to check order status page and maybe redirects to some other page.</p>
<p>I guess my question has to do with the server thread that made the request of the long running external service and that has now been &#8216;forgotten about&#8217; by the browser.</p>
<p>1. Is the request from the server to external system typically synchronous or asynchronous?<br />
-If sync, the server thread sits and waits.<br />
-If async, then the server must be able to poll the external process for progress or the external process must provide some type of call back.<br />
2. What is standard practice, if there is such a thing as standard? What do you see as the more common architecture?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

