Cache Access In Highly Concurrent Systems

Nov 16, 2010

Suppose I have two threads(Thread1, Thread2) where the threads are accessing the cache for a given object such as in the code below nearly at the same time:

Dim expensiveToGetData = Cache("ExpensiveDataKey")
If ExpensiveToGetData is nothing then
'because the cache has expired
ExpensiveToGetData = LoadExpensiveDataFromDataSource()
Cache("ExpensiveDataKey") = ExpensiveToGetData
end If
ProcessExpensiveData(ExpensiveToGetData)

Isn't it possible for both threads to load the cache because they both requested data from the cache that was nothing/expired? I've run some tests on a local machine and it seems that the cache is being loaded more than once. Is this a normal pattern?

View 2 Replies


Similar Messages:

C# - Access Session Value During Concurrent Requests

Mar 9, 2010

in one request i am updating session variable. in the other request, i am trying to access that session value, but it was blocked until the first request finish. I am using C# with ASP.NET 2.0 UPDATE: My page code looks like this.

while(int progress = DoWork() && progress <= 100 ){
Session["Progress"] = progress;
}

and my handler just return Session value.

context.Response.Write(Session["progress"].toString());
context.Response.End();

View 1 Replies

C# - Application_End() Cannot Access Cache Through HttpContext.Current.Cache

Dec 12, 2010

I want to be able to maintain certain objects between application restarts.

To do that, I want to write specific cached items out to disk in Global.asax Application_End() function and re-load them back on Application_Start().

I currently have a cache helper class, which uses the following method to return the cached value:

return HttpContext.Current.Cache[key];

Problem: during Application_End(), HttpContext.Current is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[] to retrieve any of the items to save to disk.

Question: how can I access the cache items during Application_End()?

View 4 Replies

Web Forms :: Concurrent User Access In An ASP Application

Oct 21, 2010

If multiple users access a web-form at the same time, how can I allow that using my code? Essentially each user reads and writes one variable in the application, and concurrent access is causing problem there.

View 5 Replies

State Management :: Concurrent Access To Session Object

Mar 30, 2010

I am stuck with the issue of concurrent access to Session object. Actually my problem is i m writing to session in frame1 and trying to access that same Session object at the same time in Frame2's Page. I know about the reader/writer lock. I made the enablesessionstate = readonly in the page where i m writing to session. its giving me strange behavior on IE and firefox.

Its working concurrently in IE8 ( means page2 is diplaying modified values while page1 is changing the session object) but does not work in Firefox even page load is not called untill function on page 1 completed. Either anyone can fix my issue with firefox or there is new solution to reader/writer lock so that i can read the session at the same time while writing.

View 2 Replies

C# - ToolkitScriptManager Throws NullReferenceException During Concurrent Access To A Page For The First Time

May 14, 2010

i'm developing a ASP.NET web application which uses the AjaxControlkit 3.0.30512.20315. I have a ToolkitScriptManager instance on my master page which has some ScriptReferences in the CombineScripts collection. If i access my default page from 2 differenct clients after an iisreset, i get the following exception

[NullReferenceException: Object Reference not set to an instance of an object.]
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +143
System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) +11
AjaxControlToolkit.ToolkitScriptManager.GetScriptCombineAttributes(Assembly assembly) +129
AjaxControlToolkit.ToolkitScriptManager.IsScriptCombinable(ScriptEntry scriptEntry) +148
AjaxControlToolkit.ToolkitScriptManager.OnResolveScriptReference(ScriptReferenceEventArgs e) +415
System.Web.UI.ScriptManager.RegisterScripts() +191
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8698462
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029

Using .NET Reflector i found out that the GetScriptCombineAttributesmethod access a static dictionary, which is not protected against concurrent access. Either i have a race condition in my code or there is a bug in the AjaxToolkit.

View 2 Replies

Concurrency - SqlConnection Already Open In Case Of Concurrent Access To Same Page

Dec 29, 2010

I have a strange problem in my ASP.Net 3.5 application. When multiple users try to access the same page (which has some long running methods), the application crashes at a point where it tries to open a connection to the database (a static method inside a static class). It appears that the connection is already open. However, this does not happen when there is only one user using the application. What I cannot understand is that how do actions of one user affect the other in a web application?

I double checked that all my open connections are being closed after performing their operation by appending a line of text to a text file whenever a connection is opened or closed. The number of opened and closed connections was equal. Also, the connections are opened and closed from one place only, where the close method is inside a Finally() block.

View 1 Replies

C# - SQlite / Firebird - Support Multiple Concurrent Write Access?

May 19, 2010

I currently store ASP.net application data in XML files. Now the problem is I have asynchronous operations, which means I ran into the problem of simultanous write access on a XML file... Now, I'm considering moving to an embedded database to solve the issue. I'm currently considering SQlite and embeddable Firebird. I'm not sure however if SQlite or Firebird can handle multiple concurrent write access. And I certainly don't want the same problem again. Anybody knows? SQlite certainly is better known, but which one is better - SQlite or Firebird ? I tend to say Firebird, but I don't really know. No MS-Access or MS-SQL-express recommodations please, I'm a sane person.

View 5 Replies

Proper Gridview Alternative - Highly Customizable

May 7, 2010

What is the proper alternative to Gridview in ASP.NET? By proper I mean highly customizable, css and JQuery friendly.

View 1 Replies

Tools And Technologies For A Highly Secure Web Application?

Sep 25, 2010

We're planning to build a web application that needs to be highly secure because a lot of money and reputation is at risk. Therefore I'm looking for tools and technologies that in that endeavor. The tools and technologies should prevent things like SQL injection, cross-site scripting vulnerabilities, remote code execution etc.

Our team has a solid knowledge about such vulnerabilities. But every developer makes mistakes, and a simple mistake shouldn't lead to a security vulnerability. They should be prevented or detected by web application framework, application server, programming language, security library, code analyzer etc.

A simple example: If you insert data into HTML, it needs to be escaped so it's properly displayed and not misused for injecting scripts. Some web application frameworks put this burden on the developers. If they forget the escaping in one place, they've got a security problem. A good tool wouldn't just do the escaping automatically, it would even prevent the developers from doing it forcefully.

I'm not looking for recommendations regarding the firewall (we have a good one), hardening the operating system (that's part of the plan), use of encrypted communication (it will be the only option) and secure authentication (a hardware token will be used). Rather, the recommendations should center around the application server and the web application software to be built.

We also fully understand that writing secure software is more than just technology: It involves knowledgable people, management attention, time and money and software quality processes. So far, this is not the problem and not the focus of this question.

I should mention that we have a certain bias towards Java and .NET.

So what tools and technologies or combinations thereof can you recommend us?

View 5 Replies

SQL Server :: Concurrent Access In SQL Server 2005

Mar 7, 2011

I have a .net web application (framework 2.o) and SQL Server 2005 as my backend. I need to design an application which fetches a particular unique pin number to a customer and then mark this record as used. The problem I face is as the no of concurrent users are more , same pin number is getting allotted to multiple users.

View 3 Replies

How To Access Cache When No HttpContext.Current Is Available

Dec 15, 2010

During Application_End() in Global.aspx, HttpContext.Current is null. I still want to be able to access cache - it's in memory, so want to see if I can reference it somehow to save bits to disk.

Question - is there a way to reference cache in memory somehow when HttpContext.Current is null?

Perhaps I could create a global static variable that would store pointer to cache that I could update on HTTP requests (pseudo: "static <pointer X>" = HttpRequest.Current) and retrieve a reference to cache through that pointer in Application_End()?

Is there a better way to access Cache in memory when there is no Http Request is made?

View 3 Replies

Access Session / Cache From Class In App_code?

Feb 8, 2010

Is that possible to get access to Session, Cache, Server.MapPath() from a class in App_code?

View 1 Replies

C# - Making Cache Access Methods Static?

Nov 12, 2010

In ASP.NET, is there any reason not to make a set of functions that Add/Remove/Get from the Cache object Static?Get() - just gets the item, no reason not to be staticAdd(), Remove() - I've read that adding/deleting into the cache has it's own internal locking mechanism, so they can be static without me creating my own lock(){} wrapping.

View 1 Replies

Security :: Access HttpApplication Cache From Different Application / Domain?

Sep 18, 2010

How can I access the cache of one web application/domain from another web application/domain?Here is my scenario. I need to verify/check the existence of a certain object in one web application/domain's cache from another web application/domain.

View 1 Replies

Queue Access To The Database To Avoid Multiple Cache Items?

Jun 7, 2010

I have a music related ASP.NET web site which caches a lot of static information from the database on the first request.Sometimes, the application is reset and cache is cleared while the application is on heavy load and then all http requests go to the database to retrieve that static data and cache it for other requests.

How can I ensure that only one request go to the database and cache the results, so that other request simply read that info from cache and not needlessly retrieve the same info over and over again.Can I use thread locking? For example, can I do something like lock(this) { db access here }?

View 2 Replies

State Management :: Create Cache Object Every Time On Access?

Aug 7, 2010

This source what i have used to create cache object.Also i have checked if "AppCache_Caption" cache object is available or not.
[Code]....
Right now i have checked and created my login page page_load event.It will create cache object every time me access the login page.What are the conditions wrong my source?My expectation, cache object creates only one time.It will not create everytime.

View 4 Replies

Web Forms :: 2 Systems Not Works Simultaneously

Jan 12, 2011

I have 2 Web applications in the same IIS with the virtual directory structure below:

http://www.mydomain.com/site1
http://www.mydomain.com/site2

both site1 an site2 are using form authentication and creating the token further adding in cookie as below,

FormsAuthentication.Initialize();
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,username,DateTime.Now, DateTime.Now.AddMinutes(20),rememberMeSet,globalID ,FormsAuthentication.FormsCookiePath);

// Encrypt the ticket.
String hash = FormsAuthentication.Encrypt(ticket);
//Create the authentication cookie
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);

My problem is when I'm logging in to Both site1 and site2 then these two are not running simultaneously on single browser using different tab for same user name.one is being logged out when logging to the other application and vice verse.

View 3 Replies

POS (Point Of Sale) systems work?

Jun 22, 2010

First, My project is to develop a loyalty system similar to air miles. The objective is to capture items bought in stores by means of a magnetic stripe card. The problem is I dont know how POS (Point of sale) systems work. Do I need to contact all the grocery stores individually or do I need to contact all the POS software designers individually?

Second, The objective is not just to capture a number from the card but to actually have access to the individual items bought at the store by means of the card in the form of a database.

View 1 Replies

Corp IT Systems Direction - Invest In A Or B?

Jan 12, 2010

This is more of a general question about which direction would be a better investment for the company.

Our company's core business application is written in Visual FoxPro and is about 9+ years old. The database is huge 15+ gigs and the core logic is complex and to make matters worse the data model is terrible. The two guys that built it and have maintained it all these years are at least in their 50's, so needless to say retirement or possibly death could come within the next decade or so.

This VFP app drives all our core business functions and requires terminal services and citrix to access it from the outside world. Our web apps have to interface with it via ODBC and we are always having performance issues with it. The servers that run this system are also very old, like Win 2000 server and are falling apart.

Recently we have been having meetings about upgrading the systems that run this core app as well as other services like email and file storage. The biggest expense however is buying new server hardware, OS licensing, Terminal Services licensing, Citrix licensing etc to solve some performance and outside access issues we are currently having as well as just generally bringing us to date on our systems.

The price tag is going to be in the $55K to $65K price range. So as a web developer my point of view is that this is a huge waste of money! My solution would be to invest that money in rewriting the core system to run on the web based .Net platform. This would eliminate the need for Terminal Server and Citrix licensing along with the pricey hardware and configuration management to run it on. I don't see the point in investing this kind of money in an antiquated system that should be on it's way out anyways.

I am looking to get some convincing arguments as to why this is a waste of money. Hopefully there is someone here that has faced this type of situation before that can give me some points of view. The hardware upgrade seems to be the easiest road to take because they will just have a consultant come in and do it all. A software development project would take longer, require more resources and possibly cost a little more money.

View 10 Replies

Iis7 - Error On Cache Folder In Application / Access To The Path 'Cachev10' Is Denied

Feb 17, 2011

I'm working on an ASP.NET application that accesses Team Foundation Server 2010 and creates new work items. The application is running in the DefaultAppPool, using NetworkService as the identity. I'm getting the error below:

[UnauthorizedAccessException: Access to the path 'Cachev10' is denied.]

[code]....

We were able to work around the issue by turning the Cache folder into a network share and giving NetworkService full access to the share. I'd prefer not to have to do this, but it seems to be working correctly now.

View 1 Replies

Security :: Forms Authentication Not Working On Some Systems?

Jan 28, 2010

Recently I've implemnted Single SignOn feature in my website which was developed on Framwork 2.0 using visual studio 2005.These website works on all browsers perfectly except that there two systems in my testing environment where the FormsAuthentication doesn't work on IE only.

On Those systems itself FormsAuthentication works for other browsers like mozilla.On these system I have checked that FormsAuthentication cookie is created but it lost it value as soon as other page is traversed.But when I try to login again it give me the messsage that user is already login i.e. user was able to login successfully.Both of them are currenlty using IE 8.

Following is the settins of my web.config:

[Code]....

View 2 Replies

Javascript - Security Practice For Web Based Systems?

Nov 17, 2010

My system is an asp.net website which uses sql server 2008 (mostly stored procedures, but for asychnronous calls I directly insert the sql commands). I have a web service which polls multiple databases, I use external libraries(Including office interop), and allow for uploading and downloading files - without restriction.

My asp pages use javascript and jquery for most of their functionality.

View 1 Replies

Content Management Systems That Comply With WCAG 2.0?

Jun 25, 2010

I like the look of SIteInifinity by Telerik as a content management system. Unfortunately it is not WCAG 2.0 compliant.Are there any third party CMS systems that are WCAG 2.0 complaint?

View 2 Replies

SQL Reporting :: Accessing Ssrs2008 Reports Remotely With Systems IP Without IIS?

Dec 4, 2010

i'm using ssrs2008 without IIS ...

i've created my reports and deployed in my system.. i.e

http://localhost:8080/rpt which are working fine.. (" i.e in XP prof SP3")

now i've developed an application in different system which windows server2008

in that i'm using reportviewer now.. what i want is when i run the project in

windows server the reports display from my system.. i.e my url http://myip:8080/rpt

error msg("enable to connect remotely")

i've tried by giving my [URL] in another system .. but it will ask username and password i've tried giving my system and password .. and also the system name and passward where i'm trying to execute.. the error is displayed

("An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.")

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved