Activities of "alexander.nikonov"

I returned from vacation and keep on testing. I am not sure now it's a DB thing. I run API GET request from DB via appservice and TTFB was about 3-4s. Then I replaced the AbpController code which accesses DB via appservice with already mentioned above List<int> data:

        [HttpGet]
        [Route("values/module-types/{languageCode?}")]
        public virtual async Task<List<int>> GetModuleTypeAsync([FromRoute] string languageCode = null)
        {
            return new List<int>
            {
                0, 1, 2, 3, 4, 5, 6, 7, 999, 10000
            };
            // AppService DB request is commented!!!
        }

And TTFB still is 3s!

What do you suggest? Probably it has something to do with appservice DI instantiation in AbpControllers? I tried to run it in several mins when writing to you - and the time is about 50-60ms! Another API request - with appservice engaged, run straight after this, is 200-300ms...

So in other words - sometimes TTFS is more or less OK. But sometimes it is inacceptibly slow. I need to find a root cause. Emphasizing - everything is tested on localhost, VS 2020 / 2022.

I took a look at the log, trying to find information for the case when TTFB was about 3s. Please have a look at this:

2021-09-07 18:01:35.693 +03:00 [INF] Route matched with {area = "app", controller = "FixCodeValue", action = "GetModuleType", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[AbxEps.CT.Core.Shared.LookupItemDto`1[System.Int32]]] GetModuleTypeAsync(System.String) on controller AbxEps.CentralTools.Controllers.FixCodeValues.FixCodeValueController (AbxEps.CentralTools.HttpApi). 2021-09-07 18:01:38.816 +03:00 [INF] Executing action method AbxEps.CentralTools.Controllers.FixCodeValues.FixCodeValueController.GetModuleTypeAsync (AbxEps.CentralTools.HttpApi) - Validation state: "Valid" 2021-09-07 18:01:38.996 +03:00 [INF] Executed action method AbxEps.CentralTools.Controllers.FixCodeValues.FixCodeValueController.GetModuleTypeAsync (AbxEps.CentralTools.HttpApi), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 180.5069ms.

  • about 3s between "executing controller action" and "executing action method"... What those 3s in-between were spent for? Indeed, the method execution itself took only 180ms...

UPDATE: for better understanding, I'm attaching zipped log file, where logging level was set to "Debug". This time I tried to run my problematic Details page again. Could you please have a look at the log, probably it will give you some idea?

https://1drv.ms/u/s!AhWdpZddvifTtxGBMcuy35NOzw31?e=fSMRYs

On some next run, those times could be 2-3 times less (about 1.5-2sec), which is still pretty much...

UPDATE 2: cold run today, audit and authorization is turned off - debug log displays the gap between those 2 entries:

2021-09-08 11:31:11.624 +03:00 [DBG] Executing controller factory for controller AbxEps.CentralTools.Controllers.FreeCodeValues.FreeCodeValueController (AbxEps.CentralTools.HttpApi) 2021-09-08 11:31:13.063 +03:00 [DBG] Executed controller factory for controller AbxEps.CentralTools.Controllers.FreeCodeValues.FreeCodeValueController (AbxEps.CentralTools.HttpApi)

What is happening in-between? Again, next run of this request takes 255ms, so could look like a DB stuff (and now the data is cached)... But yesterday I saw big time without DB query involved.

_identityUserAppService.GetListAsync makes 2 DB request. one for count one for the list. and I think this duration is OK. 1.44second is acceptable with a fully featured request.
Do you say it adds 300ms when you derive from AbpController? See the AbpController base class which uses Lazy properties.

probably i was not precise enough. what i wanted to say is that response time is approx 300ms when not using appservice - just forming test data in controller directly as shown in the code above. if i access real DB data from identityUserService (this exact ABP service is taken just in test purpose, because you know it well) - it is already 4sec which i suppose is too much, because usually it is said one request needs to take less than 1 sec. so what would you suggest?

Here's what I've got after modifications in a test solution:

  1. when I added authorization attribute and removed audit-disabling attribute - the time did not change;
  2. when I added ABP appservice - the picture looks like this:

        [RemoteService]
        [Authorize]
        public class TestController : AbpController
        {
            private readonly IIdentityUserAppService _identityUserAppService;

            public TestController(IIdentityUserAppService identityUserAppService)
            {
                _identityUserAppService = identityUserAppService;
            }

            [HttpGet]
            public async Task<PagedResultDto<string>> GetPositionLookupAsync()
            {
                var result = await _identityUserAppService.GetListAsync(new GetIdentityUsersInput());

                return new PagedResultDto<string>
                {
                    Items = result.Items.Select(x => x.Email).ToList(),
                    TotalCount = result.Items.Count
                };
            }
        }

Does it look OK? Even if so - it's a test solution which uses MS SQL Server DB. Our solution uses Oracle and has a lot different functionality on top of standard test solution. Also, replacing MS SQL Server with Oracle in a test solution would take too much effort.

So I suggest to focus on analysis of our problematic solution based on my input in the previous post: 4 sec is an approx response time with no authorization and disabled auditing (almost the same as initially reported time) and 300+ ms is response time with no appservice used. Please suggest what drill-down should I make - like posting some of our AbpModule code etc.

@albert since I will be out for 2 weeks, I've decided to try some experiments right away. Is it essential to create a new controller? If I got you right regarding disabling auditing and authorization, I had to put the following attributes on my controller and appservice:

[AllowAnonymous]
[DisableAuditing]

So after doing this I run existing lookup method from POSTMAN. Result is approximately the same as from Angular app before (response time varies between 4 and 16 seconds depending on how many times I run the same details page):

Researching further... So now I have to try a new controller or new Net Core project... It will take more time.

Here's new controller with a very simple output, no appservice used:

  [RemoteService]
    [Area("app")]
    [ControllerName("Test")]
    [Route("api/ct/central-tool/tests")]
    [AllowAnonymous]
    [DisableAuditing]
    public class TestController : AbpController
    {
        public TestController()
        {
        }

        [HttpGet]
        public List<int> GetPositionLookupAsync()
        {
            return new List<int>
            {
                0, 1, 2, 3, 4, 5, 6, 7, 999, 10000 
            };
        }
    }

Is this time still NOT OK? I mean it is noticeably less than previous, but this code does not use DI (getting appservice instance), does not access DB... And it is still 300+ ms... Should I proceed with a new project or should I proceed with investigating appservice code somehow?

UPDATE: in fact I have had test solution based on ABP Framework 4.3.0. I used the same test method as above and here is the timing from Swagger (I did not manage to run it from Postman, getting some weird Invalid character in header content ["Host"] error, even though there was nothing wrong with the URL):

Looking forward for your recommendation as to my next actions.

@albert Redis is already disabled

@maliming Here are logs from both HttpApi hosts. Level was set to 'Debug': .MinimumLevel.Override("Microsoft", LogEventLevel.Debug)

Please be aware, that this time response times are less - though, they are still too big:

https://1drv.ms/u/s!AhWdpZddvifTtw10XrTEduNTBt8-?e=RKpfLs https://1drv.ms/u/s!AhWdpZddvifTtwzipyhO1VtNwgbF?e=3oxwaQ

P.S. Could you please add possibility to attach log files to a message, not only images?

Answer

Let's say I have a lot of localizations and edit something at page 6 (UserName):

After editing is done, the grid is reloading to page 1, which is not very user-friendly: I'd prefer to stay at the same page and see the record I've just edited. Or sort the records by modification date in descending order - this way my record will be at the top of the grid and I won't need to look for it.

Answer

@maliming

Actually i've managed to achieve this, but using slighly different approach: i've overriden a couple of classes, where filtered existing permissions, but using licence rules:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IPermissionAppService))]
    [Authorize]
    public class CentralToolsPermissionAppService : PermissionAppService
    
    public class CentralToolsRolePermissionValueProvider : RolePermissionValueProvider
    

This way I get the filtered roles in the menu and in the Role Permission management. I am not sure we would use Client Permission Management for clients, but then probably I would need to override that provider too.

Possibly I am missing something??

Another approach - to use client-side changes: to override RoutesService and PermissionGuard in Angular app - so they would react on licence rules: so menu items will be filtered out and service access will be restricted based on these rules...

Are existing permissions are cached somehow by ABP? BTW, we do not use Redis so far and still not planning too... So if it's about caching - we will use something simple built-in...

Answer

You can create some permissions

We have a list of module IDs (each module can be considered as a separate page in navigation menu) and we would prefer not to mix that with "permissions", since it's another conception. And we would like to use it in parallel with requiredPolicy as shown in screenshot:

ModuleId needs to be checked in Licence Provider and decide whether the given user has access to the given module ID (page): if not - the page is not displayed in the navigation menu neither user can access data for it.

Answer

Can you try the latest? 4.3.2

I've tried 4.3.2 and now Task<MultiplePermissionGrantResult> CheckAsync(PermissionValuesCheckContext context) is not triggered at all for a logged user: is it correct behavior? When it needs to be triggered??

The angular permission check happens locally, the server will check all the permissions of the current user or user's role etc and return to angular. The menu just checks whether the permission is granted

Yes, I understand - but how to extend "permissions" functionality and use some custom things like our moduleId in our licence provider?

Showing 191 to 200 of 276 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30