Base solution for your next web application
Open Closed

Takes too long to hit controller action #2608


User avatar
0
sparkyjr created

Hi,

Wherever we have injected few application services into controller class's constructor, and if the constructor of any of these application services has many items injected, then it takes too long (as long as 20 sec) to hit the controller action.

Could you please help and suggest some robust solution here?

Thanks in advance! SparkyJr


8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We didn't face such a case until now in our project. Can you give a number for >these application services has many items injected . We will try to create the same scenario.

    Is there any time consuming operation in one of the injected class's constructor ? Maybe you have missed one becasue there are many injected class, is it possible ?

    Thanks.

  • User Avatar
    0
    trendline created

    it is spending so long time to wait server get response in my application too, maybe I also encountered the same issue.

  • User Avatar
    0
    sparkyjr created

    Thanks ismcagdas for your reply!

    I will try to answer some of your questions:

    <cite>ismcagdas: </cite> Can you give a number for >these application services has many items injected . We will try to create the same scenario.

    We have 20 repositories and 15 application services injected in a constructor of one of the application service. Let me give you an example to make it clear:

    I have 3 application services, say, A, B and C. Here, constructor of C has 25 items (20 repositories and 5 application services) injected in its constructor constructor of B has 35 items (25 repositories and 10 application services - one of them is C) injected in its constructor constructor of A has 35 items (20 repositories and 15 application services - two of them are B and C) injected in its constructor

    <cite>ismcagdas: </cite> Is there any time consuming operation in one of the injected class's constructor ? Maybe you have missed one becasue there are many injected class, is it possible ?

    So, the constructor of C is being initialized 3 times (well, 5 times in real case). This cascading effect is causing the problem. At least, that is what I think.

    Any suggestions?

    Thanks, SparkyJr

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thank you for your detailed explanation. It is hard to create such a scneario for us. Can you try to comment out 3 app services (A,B and C) one by one and see if one of them makes a big difference. Because we think that injecting that much class should not take this amount of time.

    Thanks.

  • User Avatar
    0
    trendline created

    Any updates for this thread? The same application service, if request it via action in a controller, it really spent a long time to get server response. But if request the service via dynamic proxy API, it could get server response quickly.

    So, should be some performance issue with it.

    For example, the official demo, to get the user list, MPA page will spend more time to get server response than SPA page.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This might be a different case with @sparkyjr have. We will try to reproduce it with your explanation.

    Thanks.

  • User Avatar
    0
    trendline created

    @ismcagdas, do you figure out the reason? could you share some suggestion to us? My application using MPS mode, take too long time get response from server really reduces the user experience.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We have tried your scenario but couldn't repeat the problem. In my tests, I opened user pages in our demo both for SPA and MPA, then tried to load user list by clicking search button. MPA took 112ms and SPA took 113ms.

    Can you provide further information if you can, so we will be able to reproduce it.

    Thanks.