Simple Idea For Passing Data To Huge Number of Users

[ This Blog Was Moved To : http://www.diknows.com ]


Three years ago, I had a situation when I was building a web application for a stocks consultant. It should provide users with updates , in a page that gets automatically refreshed every 1 minute.

My problem was that when the number of logged in users exceed 100 users, the page turns to be extreemly slowly rendered.

The problem was that I made that page retrieve the data from database every time the page refresh. Ofcourse it should.

I thought of a simple solution, as there was one stocks consultant ( for me data editor ), and it was one page that is needed to get rendered. I decided not to make it dynamically retrieved, but dynamically created.

Which means, I create the HTML page directly after the stocks consultant finishs editing his data that will be shown to his clients ( At that time I wasn’t using AJAX , and the output was fairly simple ). And, With each refresh I retrieve the HTML static page, that was previously created.

After a while, I decided to make it a little more efficient, by checking the file’s SHA1 and compare it with the latest SHA1 of the same file, if they are the samee ( File didn’t change from last retrieval ), I return back a copy that was previously stored in Memory, else I retrieve the generated file, update the memory cache, then send the memory cache back to users.

Ofcourse, If I am creating this application right now, I would be using the same idea, except for saving data in JSON not HTML and send it back to users ( ofoucrse using AJAX ) and render it ( at the client side ).

I dunno actually if compressing JSON data using GZIP is applicable or what, I hope someone tell me that !! ,, ( ofcourse if I’m creating a similar application right now , I will be asking Uncle Google’s Help for GZIP with JSON )

Hope I could be of some help.

Advertisements

Windows Start-up Date

[ This Blog Was Moved To : http://www.diknows.com ]


Recently I Needed to know when was the Windows Server Machine restarted and Why ?

So, I executed the command in CMD


net statistics server

  • The Start up time is : Statistics since 8/16/2009 5:40 AM
  • Then From Event Viewer I sorted System Logs by Source
  • Searched for User32 and matched Date with the output of `net statistics server` to know the cause of system restart.
  • With a double click on the record, I found something like that
The process winlogon.exe has initiated the restart of computer APPLICATION0 on behalf of user NT AUTHORITY\SYSTEM for the following reason: No title for this reason could be found
Reason Code: 0x80020002

Shutdown Type: restart
Comment:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
  • Now, I Could figure out that User NT AUTHORITY\SYSTEM Has initiated a restart intintionally.

Thats All Admins.