Showing posts with label bit. Show all posts
Showing posts with label bit. Show all posts

Thursday, March 29, 2012

Performance of CollectionBase class

Hi Guys,

I have a doubt which is little bit conceptual rather than a coding
convention.

I have a a table called products in which I have 40000 and odd products
which is expected to be frequently
accessed by the website. I'm having doubt in how fast i can serve this
product details to the requesting clients.

Basically, I have created necessary stored procedures to pull out the data
from the database. Now, I'm planning to have
a data access layer called product (a class) which contains properties,
enumerators etc., to load all the product details
by executing the stored procedure. That is, the data access layer will be
used by the business layer to deal with the product
details in the means of populating it in the webpage, filtering etc.,

So, the product class inherits Collectionbase class to have all the
enumerator, indexer funtionalities which is nothing
but a custom data source and which can be used with DataGrid etc., and all
the business logic like how to populate, what
to populate has been written in the business layer (it uses the data layer
to define the bl), which is eventually used by
the web developers to design the dynamic pages of the site.

I'm having doubt whether this kind of approach will work best in web
atmosphere rather than a windows application or not?
and also loading 40,000 records in a collection base object will give better
performance or not?

Please kindly suggest me, how to proceed in the terms of which is better way
to deal with this.

Thanks in Advance
Vadivel KumarI would put this way- if you are going to pull all 40K records in the
collection class and your web site will have multiple visitors (that means
multiple instances of the same class would be urnning in memory)- you are
definitely experience performance problem. If the business logic permits, I
would only pull the records necessary.

Also, .NET has memeory problem with larger objects (40K records is
definitely one of that kind). You are on the right track to analyse the
problem but you may have to compromise some performance to keep the business
logics flowing.

Prodip

"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
better
> performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
way
> to deal with this.
> Thanks in Advance
> Vadivel Kumar

On Tue, 15 Feb 2005 08:46:01 -0600, "Prodip Saha" <psaha@.bear.com>
wrote:

>Also, .NET has memeory problem with larger objects (40K records is
>definitely one of that kind). You are on the right track to analyse the
>problem but you may have to compromise some performance to keep the business
>logics flowing.

40k records would be a large collection of many small objects - which
can cause problems too.

--
Scott
http://www.OdeToCode.com/blogs/scott/
For example, my data layer contains a class called "product" which inherits
IEnumerator interface and this
class is used by business layer class "products" in which
i have written all my business logic etc.,

So, while retriving the any number of product i'm iterating
from product class in products class.

Is this makes sense and I'm following the standards? and If i follow the
standards i have to give up the price of performance. So, is this shows the
standards are not right?

I'm literrally confused. Advice me.

Thanks & Regards
Vadivel Kumar

"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
> better performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
> way to deal with this.
> Thanks in Advance
> Vadivel Kumar
And, I would like to know another one stuff like I'm developing a set of
libraries
which can be used with windows or web based interface my library code will
execute based on which kind
of interface it is deployed.

So, how to check this in C#, if you take C i normally use
preprocessor directive to check which platform, which architecture etc.,
based on that i will define my functions.

Kindly help me on this.

Thanks in Advance
Vadivel Kumar

"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
> better performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
> way to deal with this.
> Thanks in Advance
> Vadivel Kumar

Performance of CollectionBase class

Hi Guys,
I have a doubt which is little bit conceptual rather than a coding
convention.
I have a a table called products in which I have 40000 and odd products
which is expected to be frequently
accessed by the website. I'm having doubt in how fast i can serve this
product details to the requesting clients.
Basically, I have created necessary stored procedures to pull out the data
from the database. Now, I'm planning to have
a data access layer called product (a class) which contains properties,
enumerators etc., to load all the product details
by executing the stored procedure. That is, the data access layer will be
used by the business layer to deal with the product
details in the means of populating it in the webpage, filtering etc.,
So, the product class inherits Collectionbase class to have all the
enumerator, indexer funtionalities which is nothing
but a custom data source and which can be used with DataGrid etc., and all
the business logic like how to populate, what
to populate has been written in the business layer (it uses the data layer
to define the bl), which is eventually used by
the web developers to design the dynamic pages of the site.
I'm having doubt whether this kind of approach will work best in web
atmosphere rather than a windows application or not?
and also loading 40,000 records in a collection base object will give better
performance or not?
Please kindly suggest me, how to proceed in the terms of which is better way
to deal with this.
Thanks in Advance
Vadivel KumarI would put this way- if you are going to pull all 40K records in the
collection class and your web site will have multiple visitors (that means
multiple instances of the same class would be urnning in memory)- you are
definitely experience performance problem. If the business logic permits, I
would only pull the records necessary.
Also, .NET has memeory problem with larger objects (40K records is
definitely one of that kind). You are on the right track to analyse the
problem but you may have to compromise some performance to keep the business
logics flowing.
Prodip
"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
better
> performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
way
> to deal with this.
> Thanks in Advance
> Vadivel Kumar
>

On Tue, 15 Feb 2005 08:46:01 -0600, "Prodip Saha" <psaha@.bear.com>
wrote:

>Also, .NET has memeory problem with larger objects (40K records is
>definitely one of that kind). You are on the right track to analyse the
>problem but you may have to compromise some performance to keep the busines
s
>logics flowing.
>
40k records would be a large collection of many small objects - which
can cause problems too.
Scott
http://www.OdeToCode.com/blogs/scott/
For example, my data layer contains a class called "product" which inherits
IEnumerator interface and this
class is used by business layer class "products" in which
i have written all my business logic etc.,
So, while retriving the any number of product i'm iterating
from product class in products class.
Is this makes sense and I'm following the standards? and If i follow the
standards i have to give up the price of performance. So, is this shows the
standards are not right?
I'm literrally . Advice me.
Thanks & Regards
Vadivel Kumar
"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
> better performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
> way to deal with this.
> Thanks in Advance
> Vadivel Kumar
>
And, I would like to know another one stuff like I'm developing a set of
libraries
which can be used with windows or web based interface my library code will
execute based on which kind
of interface it is deployed.
So, how to check this in C#, if you take C i normally use
preprocessor directive to check which platform, which architecture etc.,
based on that i will define my functions.
Kindly help me on this.
Thanks in Advance
Vadivel Kumar
"Vadivel Kumar" <donotreply@.spam-i-love-u.com> wrote in message
news:uBxbJK2EFHA.2700@.TK2MSFTNGP14.phx.gbl...
> Hi Guys,
> I have a doubt which is little bit conceptual rather than a coding
> convention.
> I have a a table called products in which I have 40000 and odd products
> which is expected to be frequently
> accessed by the website. I'm having doubt in how fast i can serve this
> product details to the requesting clients.
> Basically, I have created necessary stored procedures to pull out the data
> from the database. Now, I'm planning to have
> a data access layer called product (a class) which contains properties,
> enumerators etc., to load all the product details
> by executing the stored procedure. That is, the data access layer will be
> used by the business layer to deal with the product
> details in the means of populating it in the webpage, filtering etc.,
> So, the product class inherits Collectionbase class to have all the
> enumerator, indexer funtionalities which is nothing
> but a custom data source and which can be used with DataGrid etc., and all
> the business logic like how to populate, what
> to populate has been written in the business layer (it uses the data layer
> to define the bl), which is eventually used by
> the web developers to design the dynamic pages of the site.
> I'm having doubt whether this kind of approach will work best in web
> atmosphere rather than a windows application or not?
> and also loading 40,000 records in a collection base object will give
> better performance or not?
> Please kindly suggest me, how to proceed in the terms of which is better
> way to deal with this.
> Thanks in Advance
> Vadivel Kumar
>

Monday, March 26, 2012

PerformanceCounter / System Up Time / TimeSpan

Hi all,
I'm having a bit of trouble with the following function...
Private Function GetSystemUpTime() As TimeSpan
' declare variables
Dim Result As TimeSpan
Dim PerformanceCounter As PerformanceCounter
' create new instances of our objects
PerformanceCounter = New PerformanceCounter("System", "System Up Time")
' populate
Result = TimeSpan.FromSeconds(PerformanceCounter.NextValue())
' return result
Return Result
End Function
For some reason I keep getting the value 0 (zero) for days, hours,minutes,
seconds etc - ie, I've tried this on 2 machines now and the result is always
the same. I've tried other counters using a similar method (for available
memory,application restarts etc) and they do come through...
Can anyone shed any light on this for me...
PS: I've had a bit of a look online and I'm aware of the environment.tick
thing but that has a problem over a value of 24 (goes to minus numbers) so
would prefer to use a PerformanceCounter object.
Regards
RobThe first call always returns zero, apparently... see the page here:
http://www.sitepoint.com/forums/pri...ad.php?t=376778
Regards,
Brett.
Rob Meade wrote:
> Hi all,
> I'm having a bit of trouble with the following function...
> Private Function GetSystemUpTime() As TimeSpan
> ' declare variables
> Dim Result As TimeSpan
> Dim PerformanceCounter As PerformanceCounter
> ' create new instances of our objects
> PerformanceCounter = New PerformanceCounter("System", "System Up Time"
)
> ' populate
> Result = TimeSpan.FromSeconds(PerformanceCounter.NextValue())
> ' return result
> Return Result
> End Function
> For some reason I keep getting the value 0 (zero) for days, hours,minutes,
> seconds etc - ie, I've tried this on 2 machines now and the result is alwa
ys
> the same. I've tried other counters using a similar method (for available
> memory,application restarts etc) and they do come through...
> Can anyone shed any light on this for me...
> PS: I've had a bit of a look online and I'm aware of the environment.tick
> thing but that has a problem over a value of 24 (goes to minus numbers) so
> would prefer to use a PerformanceCounter object.
> Regards
> Rob
"Brett Wiltshire" wrote ...

> The first call always returns zero, apparently... see the page here:
> http://www.sitepoint.com/forums/pri...ad.php?t=376778
Hi Bretty,
Thanks for your reply - you know - in the example I saw that had this code
it actually said about that - I assumed - clearly wrongly - that the
"NextValue()" thing meant - go get the next one because the first one is
always zero...
*sigh*
That's taken up 2 hours of my day searching the net just for a
misunderstanding :o(
Anyway, many thanks for your reply - I've for now just duplicated the line
that gets it and it works fine :o)
Thanks
Rob

PerformanceCounter / System Up Time / TimeSpan

Hi all,

I'm having a bit of trouble with the following function...

Private Function GetSystemUpTime() As TimeSpan

' declare variables
Dim Result As TimeSpan
Dim PerformanceCounter As PerformanceCounter

' create new instances of our objects
PerformanceCounter = New PerformanceCounter("System", "System Up Time")

' populate
Result = TimeSpan.FromSeconds(PerformanceCounter.NextValue( ))

' return result
Return Result

End Function

For some reason I keep getting the value 0 (zero) for days, hours,minutes,
seconds etc - ie, I've tried this on 2 machines now and the result is always
the same. I've tried other counters using a similar method (for available
memory,application restarts etc) and they do come through...

Can anyone shed any light on this for me...

PS: I've had a bit of a look online and I'm aware of the environment.tick
thing but that has a problem over a value of 24 (goes to minus numbers) so
would prefer to use a PerformanceCounter object.

Regards

RobThe first call always returns zero, apparently... see the page here:
http://www.sitepoint.com/forums/pri...ad.php?t=376778

Regards,
Brett.

Rob Meade wrote:
> Hi all,
> I'm having a bit of trouble with the following function...
> Private Function GetSystemUpTime() As TimeSpan
> ' declare variables
> Dim Result As TimeSpan
> Dim PerformanceCounter As PerformanceCounter
> ' create new instances of our objects
> PerformanceCounter = New PerformanceCounter("System", "System Up Time")
> ' populate
> Result = TimeSpan.FromSeconds(PerformanceCounter.NextValue( ))
> ' return result
> Return Result
> End Function
> For some reason I keep getting the value 0 (zero) for days, hours,minutes,
> seconds etc - ie, I've tried this on 2 machines now and the result is always
> the same. I've tried other counters using a similar method (for available
> memory,application restarts etc) and they do come through...
> Can anyone shed any light on this for me...
> PS: I've had a bit of a look online and I'm aware of the environment.tick
> thing but that has a problem over a value of 24 (goes to minus numbers) so
> would prefer to use a PerformanceCounter object.
> Regards
> Rob
"Brett Wiltshire" wrote ...

> The first call always returns zero, apparently... see the page here:
> http://www.sitepoint.com/forums/pri...ad.php?t=376778

Hi Bretty,

Thanks for your reply - you know - in the example I saw that had this code
it actually said about that - I assumed - clearly wrongly - that the
"NextValue()" thing meant - go get the next one because the first one is
always zero...

*sigh*

That's taken up 2 hours of my day searching the net just for a
misunderstanding :o(

Anyway, many thanks for your reply - I've for now just duplicated the line
that gets it and it works fine :o)

Thanks

Rob
Anyone know if its possible to pull the same information from different
machines on the network?

A new instance of PerformanceCounter seems to be able to take a machine
name - but I've tried this and get access denied errors...

I guess i some how need to be able to tell the servers in question that the
ASP.Net process model is allowed to access this?

Any ideas anyone?

My other thought was as a web service, so I have one page which drags the
info from the other servers, this would of course then rely on IIS being
present, not so good for my clustered SQL Servers! Open to suggestions...

Regards

Rob