abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.31k stars 3.32k forks source link

Separate Identity Server: Performance Issue #4267

Closed a-patel closed 3 years ago

a-patel commented 3 years ago

Separate Identity Server: Performance Issue:

Using the above options, I have created a sample application. I haven't made any changes, But I am not able to log in.

a-patel commented 3 years ago

https://localhost:44312/api/abp/application-configuration https://localhost:44312/.well-known/openid-configuration

Above API calls take more than 5-10 minutes every time during development.

realLiangshiwei commented 3 years ago

Did you start the redis server? Please provide logs Thanks.

a-patel commented 3 years ago

@liangshiw Can we make Redis optional?

maliming commented 3 years ago

The applications use Redis as as distributed cache. So, you need to have Redis installed & running.

a-patel commented 3 years ago

I have changed the Redis connection string and made sure that it is running. Now I am able to get responses and able to log in. But still, it is taking more than 10s -1 minute for some API call.

https://localhost:44373/.well-known/openid-configuration/jwks https://localhost:44373/connect/token https://localhost:44312/api/abp/application-configuration

ABP-IDV-Issue - After-Redis

maliming commented 3 years ago

Please check the application log.

a-patel commented 3 years ago

Logs (Identity Server):

2020-06-09 14:14:44.824 +05:30 [INF] Request finished in 13143.7343ms 200 application/json; charset=UTF-8 2020-06-09 14:14:45.023 +05:30 [INF] Request starting HTTP/1.1 GET https://localhost:44373/.well-known/openid-configuration/jwks
2020-06-09 14:14:45.028 +05:30 [DBG] Request path /.well-known/openid-configuration/jwks matched to endpoint type Discovery 2020-06-09 14:14:58.524 +05:30 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryKeyEndpoint 2020-06-09 14:14:58.524 +05:30 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks 2020-06-09 14:14:58.524 +05:30 [DBG] Start key discovery request 2020-06-09 14:14:58.526 +05:30 [INF] Request finished in 13503.4084ms 200 application/jwk-set+json; charset=UTF-8

logs.txt

maliming commented 3 years ago

Please follow the logs to solve your problem.

 [WRN] It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 1s ago, last-write: 1s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 6s ago, v: 2.0.593.37019
a-patel commented 3 years ago

That was old logs before local Redis. Then I have changes the Redis (Azure Redis) server endpoint. Above mentioned logs (my comment) are after that change.

a-patel commented 3 years ago

@maliming @hikalkan Please re-open this issue.

a-patel commented 3 years ago

I am doing the above things again. (Fresh start - with working Redis and deleting old logs) Still taking too much time.

ABP with IDV - Login - API Calls

a-patel commented 3 years ago

New Logs (Identity Server):

2020-06-09 15:17:31.516 +05:30 [INF] Request finished in 13397.3514ms 200 application/json; charset=UTF-8 2020-06-09 15:17:31.581 +05:30 [INF] Request starting HTTP/1.1 GET https://localhost:44373/.well-known/openid-configuration/jwks
2020-06-09 15:17:31.584 +05:30 [DBG] Request path /.well-known/openid-configuration/jwks matched to endpoint type Discovery 2020-06-09 15:17:44.881 +05:30 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryKeyEndpoint 2020-06-09 15:17:44.881 +05:30 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks 2020-06-09 15:17:44.881 +05:30 [DBG] Start key discovery request 2020-06-09 15:17:44.885 +05:30 [INF] Request finished in 13303.8247ms 200 application/jwk-set+json; charset=UTF-8

logs.txt

maliming commented 3 years ago

hi @a-patel Can you check the logs of the identity server project?

All the information is in the log.

a-patel commented 3 years ago

I already have checked that, also attached whole log file in my previous comment.

a-patel commented 3 years ago

If I am trying without Identity Server option while creating the project then it is working fine,

maliming commented 3 years ago

hi @a-patel

I can't reproduce your problem. The response of the Identity server is fast in my computer. Can you try another computer?

a-patel commented 3 years ago

@maliming I have tried on other machine, other browsers, private browser, etc. It takes around 1-2 minutes to complete the above API call. (With invalid Redis Connection string, it was taking 5-10+ minutes)

maliming commented 3 years ago

hi

Please try to remove the redis related code. Then the memory cache will be used.

a-patel commented 3 years ago
  1. Remove below line from AbpDemoNgHttpApiHostModule.cs

ConfigureRedis(context, configuration, hostingEnvironment);

  1. Remove below line from AbpDemoNgIdentityServerModule.cs context.Services.AddStackExchangeRedisCache(options => { options.Configuration = configuration["Redis:Configuration"]; });

I am getting the response in time after commenting on the above code.

Is this correct? Please confirm.

leonkosak commented 3 years ago

@a-patel so if Redis is NOT used, the Separated Identity Server "version" of abp still works as expected?

a-patel commented 3 years ago

Yes, If Redis is not used (after removing above code), it is working as expected. What if I want to use Redis?

leonkosak commented 3 years ago

I tried with Redis for windows(https://www.onlinetutorialspoint.com/spring-boot/setup-install-redis-server-on-windows-10.html), but I always get this error (Postgres db):

image

leonkosak commented 3 years ago

Crap, this is cookie-related issue. :( I tried in other browser and it works.

a-patel commented 3 years ago

I am using SQL Server database, I have tried in different machines.

leonkosak commented 3 years ago

@a-patel, my timings with fresh abp v2.9.0 and Redis (https://www.onlinetutorialspoint.com/spring-boot/setup-install-redis-server-on-windows-10.html):

image

@maliming, do you get comparable timings (in development environment)?

maliming commented 3 years ago

hi @a-patel @leonkosak

I think we have confirmed that this problem is related to the performance of redis, not to abp.

I am using docker's redis in wsl (ubuntu).

image

leonkosak commented 3 years ago

I agree. But in my case (my computer), the timings are acceptable (and much lower than what @a-patel environment).

xyfy commented 3 years ago

the redis on windows version is very old, I came this sence before ,when I use the new redis server in linux,it may reduce much time

xyfy commented 3 years ago

it

the redis on windows version is very old, I came this sence before ,when I use the new redis server in linux,it may reduce much time

That is when I used the old abp named aspnetboilerplate

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.