To support a webfarm scenario, I'd like to store a global array (serialized)
in a file on a network share.
In this array there is a list of pages "locked" by other users so I need to
read this array at every page access to detect if the page is "free" so the
user can access it; when the user can access the page, the page is added to
the array so the next user can't access.
What's the best way to lock this (network) file so when 2 users access the
same page, the first user changes the array (writing to file) and the second
user can only read the file after the first user has finished the task?
FileShare.None throw an error if the filestream is already open...
Thanks in advance for support and sorry for my not-so-good english language
:)
Fabio 5 1497
I'm not 100% sure I understood but..
Are you saying you keep the pages that are "locked" in a text file and read
this in all the time? If so you have bigger issues. How do you clear a
"lock"? If the person closes their browser how do you release this?
Sounds like you may need to rethink things a little at a bigger level.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Fabio R." wrote: To support a webfarm scenario, I'd like to store a global array (serialized) in a file on a network share. In this array there is a list of pages "locked" by other users so I need to read this array at every page access to detect if the page is "free" so the user can access it; when the user can access the page, the page is added to the array so the next user can't access. What's the best way to lock this (network) file so when 2 users access the same page, the first user changes the array (writing to file) and the second user can only read the file after the first user has finished the task? FileShare.None throw an error if the filestream is already open... Thanks in advance for support and sorry for my not-so-good english language :) Fabio
It works very fine, the array contains userid, pageid and the lock datetime:
locked pages are removed from array every time the same user access another
page while other pending lock are removed if older than session timeout.
For now I use a try / catch, when an IO Exception occur ("file is used by
another process") I use a Threading.Sleep to wait 10 milliseconds before
reading the file again.
Works locally, but I don't know if it will be stable when the application
will have 10-20 cuncurrent users reading/writing the file ( but a webserver
log file doesn't do the same? )...
Any suggestion / other methods?
Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio
news:01**********************************@microsof t.com... I'm not 100% sure I understood but.. Are you saying you keep the pages that are "locked" in a text file and read this in all the time? If so you have bigger issues. How do you clear a "lock"? If the person closes their browser how do you release this?
Sounds like you may need to rethink things a little at a bigger level.
-- Curt Christianson site: http://www.darkfalz.com blog: http://blog.darkfalz.com "Fabio R." wrote:
To support a webfarm scenario, I'd like to store a global array (serialized) in a file on a network share. In this array there is a list of pages "locked" by other users so I need to read this array at every page access to detect if the page is "free" so the user can access it; when the user can access the page, the page is added to the array so the next user can't access. What's the best way to lock this (network) file so when 2 users access the same page, the first user changes the array (writing to file) and the second user can only read the file after the first user has finished the task? FileShare.None throw an error if the filestream is already open... Thanks in advance for support and sorry for my not-so-good english language :) Fabio
DB may be better to track the locks (using the same cleanup practices) but if
what you have works then give it a shot I guess. I'm a bit concerned that the
file is opened/closed/read so much (every page load) that it may have issues
with scaling.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Fabio R." wrote: It works very fine, the array contains userid, pageid and the lock datetime: locked pages are removed from array every time the same user access another page while other pending lock are removed if older than session timeout. For now I use a try / catch, when an IO Exception occur ("file is used by another process") I use a Threading.Sleep to wait 10 milliseconds before reading the file again. Works locally, but I don't know if it will be stable when the application will have 10-20 cuncurrent users reading/writing the file ( but a webserver log file doesn't do the same? )... Any suggestion / other methods? Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio news:01**********************************@microsof t.com... I'm not 100% sure I understood but.. Are you saying you keep the pages that are "locked" in a text file and read this in all the time? If so you have bigger issues. How do you clear a "lock"? If the person closes their browser how do you release this?
Sounds like you may need to rethink things a little at a bigger level.
-- Curt Christianson site: http://www.darkfalz.com blog: http://blog.darkfalz.com "Fabio R." wrote:
To support a webfarm scenario, I'd like to store a global array (serialized) in a file on a network share. In this array there is a list of pages "locked" by other users so I need to read this array at every page access to detect if the page is "free" so the user can access it; when the user can access the page, the page is added to the array so the next user can't access. What's the best way to lock this (network) file so when 2 users access the same page, the first user changes the array (writing to file) and the second user can only read the file after the first user has finished the task? FileShare.None throw an error if the filestream is already open... Thanks in advance for support and sorry for my not-so-good english language :) Fabio
Mmm... DB probably (but I'm not sure) is more solid, but it's not slower
than reading the file? If it can be a better choice, how to lock the table
as I do with file?
Thanks,
Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio
news:41**********************************@microsof t.com... DB may be better to track the locks (using the same cleanup practices) but if what you have works then give it a shot I guess. I'm a bit concerned that the file is opened/closed/read so much (every page load) that it may have issues with scaling.
-- Curt Christianson site: http://www.darkfalz.com blog: http://blog.darkfalz.com "Fabio R." wrote:
It works very fine, the array contains userid, pageid and the lock datetime: locked pages are removed from array every time the same user access another page while other pending lock are removed if older than session timeout. For now I use a try / catch, when an IO Exception occur ("file is used by another process") I use a Threading.Sleep to wait 10 milliseconds before reading the file again. Works locally, but I don't know if it will be stable when the application will have 10-20 cuncurrent users reading/writing the file ( but a webserver log file doesn't do the same? )... Any suggestion / other methods? Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio news:01**********************************@microsof t.com... > I'm not 100% sure I understood but.. > Are you saying you keep the pages that are "locked" in a text file and > read > this in all the time? If so you have bigger issues. How do you clear a > "lock"? If the person closes their browser how do you release this? > > Sounds like you may need to rethink things a little at a bigger level. > > -- > Curt Christianson > site: http://www.darkfalz.com > blog: http://blog.darkfalz.com > > > > "Fabio R." wrote: > >> To support a webfarm scenario, I'd like to store a global array >> (serialized) >> in a file on a network share. >> In this array there is a list of pages "locked" by other users so I >> need >> to >> read this array at every page access to detect if the page is "free" >> so >> the >> user can access it; when the user can access the page, the page is >> added >> to >> the array so the next user can't access. >> What's the best way to lock this (network) file so when 2 users access >> the >> same page, the first user changes the array (writing to file) and the >> second >> user can only read the file after the first user has finished the >> task? >> FileShare.None throw an error if the filestream is already open... >> Thanks in advance for support and sorry for my not-so-good english >> language >> :) >> Fabio >> >> >>
DB will be faster then file
Dont physically "lock" anything, just flag it as locked and look for the
flag for accessing
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Fabio R." wrote: Mmm... DB probably (but I'm not sure) is more solid, but it's not slower than reading the file? If it can be a better choice, how to lock the table as I do with file? Thanks, Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio news:41**********************************@microsof t.com... DB may be better to track the locks (using the same cleanup practices) but if what you have works then give it a shot I guess. I'm a bit concerned that the file is opened/closed/read so much (every page load) that it may have issues with scaling.
-- Curt Christianson site: http://www.darkfalz.com blog: http://blog.darkfalz.com "Fabio R." wrote:
It works very fine, the array contains userid, pageid and the lock datetime: locked pages are removed from array every time the same user access another page while other pending lock are removed if older than session timeout. For now I use a try / catch, when an IO Exception occur ("file is used by another process") I use a Threading.Sleep to wait 10 milliseconds before reading the file again. Works locally, but I don't know if it will be stable when the application will have 10-20 cuncurrent users reading/writing the file ( but a webserver log file doesn't do the same? )... Any suggestion / other methods? Fabio
"Curt_C [MVP]" <software_at_darkfalz.com> ha scritto nel messaggio news:01**********************************@microsof t.com... > I'm not 100% sure I understood but.. > Are you saying you keep the pages that are "locked" in a text file and > read > this in all the time? If so you have bigger issues. How do you clear a > "lock"? If the person closes their browser how do you release this? > > Sounds like you may need to rethink things a little at a bigger level. > > -- > Curt Christianson > site: http://www.darkfalz.com > blog: http://blog.darkfalz.com > > > > "Fabio R." wrote: > >> To support a webfarm scenario, I'd like to store a global array >> (serialized) >> in a file on a network share. >> In this array there is a list of pages "locked" by other users so I >> need >> to >> read this array at every page access to detect if the page is "free" >> so >> the >> user can access it; when the user can access the page, the page is >> added >> to >> the array so the next user can't access. >> What's the best way to lock this (network) file so when 2 users access >> the >> same page, the first user changes the array (writing to file) and the >> second >> user can only read the file after the first user has finished the >> task? >> FileShare.None throw an error if the filestream is already open... >> Thanks in advance for support and sorry for my not-so-good english >> language >> :) >> Fabio >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MHenry |
last post by:
Hi,
We were going merrily along for 6 years using this database to record
all client checks that came into our office, including information
about what the checks were for.
Suddenly, network...
|
by: Hannu |
last post by:
Hi.
In the ldb file you can see the users of the mdb-file. If you open the
mdb-file your machine and username will be written in the lbd- file.
Allthough you close the mdb-file your name won't...
|
by: cyranoVR |
last post by:
This is the approach I used to automate printing of Microsoft Access
reports to PDF format i.e. unattended and without annoying "Save As..."
dialogs, and - more importantly - without having to use...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere
and VSS Remoting
This article makes a detailed...
|
by: Dave Kolb |
last post by:
Is there any other solution for an ASPNET application to access
network resources other than running as SYSTEM, using delegation (a
nightmare to get to work) or the COM+ solution? I cannot seem to...
|
by: Microsoft News |
last post by:
I have a web server sitting on computer 1, (QA1). Out on the network on my
main server I have a folder with a zip file in it. All I want is for the
web services that are on the web server to pick...
|
by: Sarah |
last post by:
I need to access some data on a server. I can access it directly using UNC
(i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network
drive resource (S:\Path\FileName).
Here is my...
|
by: shriil |
last post by:
Hi
I am facing a problem with regard to opening of Access Databases,
resident on pcs of my office network connected thru LAN, from my
machine on the network. The folders in which these...
|
by: gary0gilbert |
last post by:
An unusual spin to this recurring disk or network error in a Terminal
Server environment. Access 2000, Terminal Server 2000, file server is
windows 2000. All users have a separate copy of the...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |