We have 109 remote offices all running Sybase ASA Server. We collect data
from these offices and consolidate it into our main server. I have written
a program that will read from each office and synchronize the data. It
takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing
the main server. The database classes expose simple functions of
connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the
correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each
office.
It takes about 2 minutes per office, or about three hours to complete. I'd
like to run this program hourly, so I want to get the total run time down.
I've tried changing the program that calls the synchronization class to
start five threads, and keep five running. The problem I run into is that
the office database class appears to get shared between threads - I get the
same results back from what should be separate offices running in separate
threads.
How can I set it up so that each thread is entirely separate from the other
threads, including any support classes called by those threads? 6 1230
I would say, create the "office" database class within the newly started
thread, and make sure there is no
"Public Shared" variables or properties in that class.
Regards
Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect data from these offices and consolidate it into our main server. I have
written a program that will read from each office and synchronize the data. It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for
accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for
each office.
It takes about 2 minutes per office, or about three hours to complete.
I'd like to run this program hourly, so I want to get the total run time down.
I've tried changing the program that calls the synchronization class to start five threads, and keep five running. The problem I run into is that the office database class appears to get shared between threads - I get
the same results back from what should be separate offices running in separate threads.
How can I set it up so that each thread is entirely separate from the
other threads, including any support classes called by those threads?
That was the first thing I tried. There are no shared variables or
functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:B5********************@giganews.com... I would say, create the "office" database class within the newly started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect
data from these offices and consolidate it into our main server. I have written a program that will read from each office and synchronize the data. It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each office.
It takes about 2 minutes per office, or about three hours to complete. I'd like to run this program hourly, so I want to get the total run time
down. I've tried changing the program that calls the synchronization class to start five threads, and keep five running. The problem I run into is
that the office database class appears to get shared between threads - I get the same results back from what should be separate offices running in
separate threads.
How can I set it up so that each thread is entirely separate from the other threads, including any support classes called by those threads?
Ah. Scratch that. I had made some shared functions. Seems to have
eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message news:B5********************@giganews.com... I would say, create the "office" database class within the newly started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... We have 109 remote offices all running Sybase ASA Server. We collect data from these offices and consolidate it into our main server. I have written a program that will read from each office and synchronize the data.
It takes a while to run because each office only has a 128k Frame Relay.
I have two database classes: one for accessing the office, one for accessing the main server. The database classes expose simple functions of connecting, updating and reading from the databases.
I have a class that operates the synchronization - imports tables in
the correct order and performs various checks on the data.
I have a program that calls the synchronization class sequentially for each office.
It takes about 2 minutes per office, or about three hours to complete. I'd like to run this program hourly, so I want to get the total run time down. I've tried changing the program that calls the synchronization class
to start five threads, and keep five running. The problem I run into is that the office database class appears to get shared between threads - I
get the same results back from what should be separate offices running in separate threads.
How can I set it up so that each thread is entirely separate from the
other threads, including any support classes called by those threads?
Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for that
office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time
before I get a data reader. It checks correctly each time, however the data
in the reader still comes back from other offices. If I change the check
routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in threads?
What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the
constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in
message news:B5********************@giganews.com... I would say, create the "office" database class within the newly
started thread, and make sure there is no "Public Shared" variables or properties in that class.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... > We have 109 remote offices all running Sybase ASA Server. We
collect data > from these offices and consolidate it into our main server. I have written > a program that will read from each office and synchronize the data. It > takes a while to run because each office only has a 128k Frame
Relay. > > I have two database classes: one for accessing the office, one for accessing > the main server. The database classes expose simple functions of > connecting, updating and reading from the databases. > > I have a class that operates the synchronization - imports tables in
the > correct order and performs various checks on the data. > > I have a program that calls the synchronization class sequentially
for each > office. > > It takes about 2 minutes per office, or about three hours to
complete. I'd > like to run this program hourly, so I want to get the total run time down. > > I've tried changing the program that calls the synchronization class to > start five threads, and keep five running. The problem I run into
is that > the office database class appears to get shared between threads - I get the > same results back from what should be separate offices running in separate > threads. > > How can I set it up so that each thread is entirely separate from
the other > threads, including any support classes called by those threads? > >
Hi again.
As far as I know, SQLDataReader is not thread safe, use DataSet's instead.
Regards
Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl... Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for that office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time before I get a data reader. It checks correctly each time, however the
data in the reader still comes back from other offices. If I change the check routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in threads? What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... That was the first thing I tried. There are no shared variables or functions. Everything is private with the exception of the constructors.
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message news:B5********************@giganews.com... > I would say, create the "office" database class within the newly started > thread, and make sure there is no > "Public Shared" variables or properties in that class. > > Regards > Fredrik Melin > > "Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in
message > news:%2****************@TK2MSFTNGP09.phx.gbl... > > We have 109 remote offices all running Sybase ASA Server. We collect data > > from these offices and consolidate it into our main server. I
have > written > > a program that will read from each office and synchronize the
data. It > > takes a while to run because each office only has a 128k Frame Relay. > > > > I have two database classes: one for accessing the office, one for > accessing > > the main server. The database classes expose simple functions of > > connecting, updating and reading from the databases. > > > > I have a class that operates the synchronization - imports tables
in the > > correct order and performs various checks on the data. > > > > I have a program that calls the synchronization class sequentially for > each > > office. > > > > It takes about 2 minutes per office, or about three hours to complete. > I'd > > like to run this program hourly, so I want to get the total run
time down. > > > > I've tried changing the program that calls the synchronization
class to > > start five threads, and keep five running. The problem I run into is that > > the office database class appears to get shared between threads -
I get > the > > same results back from what should be separate offices running in separate > > threads. > > > > How can I set it up so that each thread is entirely separate from
the > other > > threads, including any support classes called by those threads? > > > > > >
I started to change my code to use DataSet, but don't you need Connection &
Command objects to fill the dataset? Neither the Connection nor the Command
objects are thread safe.
Is there a thread safe way to get the data? (I have to use the OLEDB.*
objects in order to use the ASA Provider.)
"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:Po********************@giganews.com... Hi again.
As far as I know, SQLDataReader is not thread safe, use DataSet's instead.
Regards Fredrik Melin
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:e%****************@TK2MSFTNGP11.phx.gbl... Okay, I'm still going nuts.
I have a piece of data in the remote office that is an identifier for
that office. I can compare it to what I have in the central database.
I put a little block of code (using GetScalar) to check this each time before I get a data reader. It checks correctly each time, however the data in the reader still comes back from other offices. If I change the
check routine to use a data reader, it returns the incorrect office.
What is going on? Is the OLEDB DataReader object just unsafe in
threads? What should I do to get around this?
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl... Ah. Scratch that. I had made some shared functions. Seems to have eliminated the problem. This had been driving me nuts!
"Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message news:uR*************@TK2MSFTNGP11.phx.gbl... > That was the first thing I tried. There are no shared variables or > functions. Everything is private with the exception of the constructors. > > > "Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message > news:B5********************@giganews.com... > > I would say, create the "office" database class within the newly started > > thread, and make sure there is no > > "Public Shared" variables or properties in that class. > > > > Regards > > Fredrik Melin > > > > "Benjamin Walling" <bw******@latnedtsaoc-reverse.com> wrote in message > > news:%2****************@TK2MSFTNGP09.phx.gbl... > > > We have 109 remote offices all running Sybase ASA Server. We collect > data > > > from these offices and consolidate it into our main server. I have > > written > > > a program that will read from each office and synchronize the data. It > > > takes a while to run because each office only has a 128k Frame Relay. > > > > > > I have two database classes: one for accessing the office, one
for > > accessing > > > the main server. The database classes expose simple functions
of > > > connecting, updating and reading from the databases. > > > > > > I have a class that operates the synchronization - imports
tables in the > > > correct order and performs various checks on the data. > > > > > > I have a program that calls the synchronization class
sequentially for > > each > > > office. > > > > > > It takes about 2 minutes per office, or about three hours to complete. > > I'd > > > like to run this program hourly, so I want to get the total run time > down. > > > > > > I've tried changing the program that calls the synchronization class to > > > start five threads, and keep five running. The problem I run
into is > that > > > the office database class appears to get shared between
threads - I get > > the > > > same results back from what should be separate offices running
in > separate > > > threads. > > > > > > How can I set it up so that each thread is entirely separate
from the > > other > > > threads, including any support classes called by those threads? > > > > > > > > > > > >
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
15 posts
views
Thread by chahnaz.ourzikene |
last post: by
|
5 posts
views
Thread by Sinan Nalkaya |
last post: by
|
10 posts
views
Thread by HK |
last post: by
|
reply
views
Thread by hynek.cihlar |
last post: by
|
9 posts
views
Thread by esakal |
last post: by
|
3 posts
views
Thread by Ronald S. Cook |
last post: by
|
5 posts
views
Thread by bean330 |
last post: by
|
reply
views
Thread by Ling |
last post: by
|
3 posts
views
Thread by dedalusenator |
last post: by
|
3 posts
views
Thread by Michael Schöller |
last post: by
| | | | | | | | | | |