C # static method vs Object Instance

I am currently developing a C # MVC REST web api, and I am trying to choose one of two options for our design.

Without delving into our design, we intend to have a class for accessing data, which we will call DataSource. Everyone DataSourcewill need to execute small, contained blocks of logic in order to correctly construct the corresponding answer. Because of the desire to be able to hot-load code in the future, we do not want them to be functions on DataSource, instead we would like them to be provided by other assemblies. We have evidence that this is implemented, and is still so good.

What I'm trying to solve is to write a static class using a single static function ExecuteQueryor write a factory method to instantiate these classes that have an instance method called ExecuteQuery.

What are the performance considerations between creating multiple short objects in each request, as well as calling static methods?

Intuitively, static methods will be faster, but I already expect that I will have a headache causing them through reflection (to support the requirement for hot downloads).

If for short-lived objects there is no huge penalty, they can win only on simplicity.

Relevant information about our expected loads:

  • 300 ms to 800 ms response time
  • Average load of about 2000 web clients
  • Peak load of about 4,000 customers
  • , 2 - 5
  • 1

, DataSource 8, 3 .

+5
4

, .

, . , , . , - factory. , Managed Extensibility Framework (MEF), . http://msdn.microsoft.com/en-us/library/dd460648.aspx.

, ? , , .

MEF, .

, Singleton .

+1

, DataSource . , . , " " , , , .

  • , , , Singleton.
  • ( - ).
  • .

, Factory, "". , , , . , Singleton.

+1

MEF. . , . ... MVC . , , /, , , . , , .

+1

" ?"

"", .

IMHO.. PSM

0

All Articles