Abp: Why and when we must use (install) redis ?

Created on 6 Apr 2020  路  18Comments  路  Source: abpframework/abp

Hi.

In documentation Redis is noted as pre-requirement.

If we use identity server included inside httpapihost project redis is not needed. If indentity server is in separate service, we must install redis. Is this correct ?

Why is that ? Can you explain a little more.
Can we avoid to install redis ?

As ABP Framework is .NET core based, it is cross platform deployable.
Redis is linux. Right ? This is not convenient for windows "users" as myself.
Can you give us some support/docks/links about redis.
I mean - some links to docs about how to ?

Please don't give me link to redis official site.
There is a lot of informations. For begginer like me, i don't know where to start.

Thanks for advance.

Edvin

inactive question

Most helpful comment

Hello @sebitsi,
Redis is volatile but can be persistent on disk to prevent data loss. Meaning; in-memory db, stored in RAM hence very very fast.

It is used for caching purpose mostly. You don't need an extra server in monolithic apps since you can use in-memory cache already which lives in your application life cycle (memcache).

But in distributed systems when you need to cache some data instead of making thousands of http requests, you need an extra server for that.

One of the use cases in ABP is for caching permissions where you need to check if the requesting token (user) has the permission of the requested resource.

I see you hate installing extra stuff to your windows like me :) Use docker for windows! Works like a charm.

Afterwards you only need to run the command docker run --nameredis-container -p 6379:6379 -d redis and change the redis connection string in your appsettings to localhost:6379.

Not to mention you can use mongodb, postgres etc on containers without installing aswell.

Hope this info helps.

All 18 comments

If indentity server is in separate service, we must install redis. Is this correct ?

Yes, redis can help to share data between IDS4 and your host.

@hitaspdotnet and @gdlcf88 Thanks for answeres.

Yes, redis can help to share data between IDS4 and your host.

How is this "sharing" related to ABP or maybe ASP.NET Core ?
I mean, is this ABP or ASP.NET core feature ?

Is this redis cache basicaly very fast service for setting and getting key-value pairs ?

I don't know more, maybe you can start looking for answers here:
https://github.com/abpframework/abp/issues/2224#issuecomment-557024682

Thanks @gdlcf88. There is no much info on this question.

I hope @hikalkan can write some documentation what is important when using ABP with redis.
Or point me to one if there is any.

I found ASP core documentation about implementing redis cache.

There is a link to chocolately windows instalation which is 4 years old.

What version do you recoment using on windows ?

What about Memurai. Do you have experience with it ?

@sebitsi Redis is also important if you have clustered environment and you use SignalR (since SignalR Core have currently no backplane option for MSSQL).

Thanks @leonkosak.

For start i just want to collect needed data for implementing identity server as standalone service.
SignalR is not in first plan. Luckily. ;)

I'm preparing to upgrade my zero projects to abp.io. It is not so easy as i expect.

It's not only about code. We must look ahead what we can and can not do in production environment.

So any additonal info is desirable.

Hello @sebitsi,
Redis is volatile but can be persistent on disk to prevent data loss. Meaning; in-memory db, stored in RAM hence very very fast.

It is used for caching purpose mostly. You don't need an extra server in monolithic apps since you can use in-memory cache already which lives in your application life cycle (memcache).

But in distributed systems when you need to cache some data instead of making thousands of http requests, you need an extra server for that.

One of the use cases in ABP is for caching permissions where you need to check if the requesting token (user) has the permission of the requested resource.

I see you hate installing extra stuff to your windows like me :) Use docker for windows! Works like a charm.

Afterwards you only need to run the command docker run --nameredis-container -p 6379:6379 -d redis and change the redis connection string in your appsettings to localhost:6379.

Not to mention you can use mongodb, postgres etc on containers without installing aswell.

Hope this info helps.

@gterdem Thanks for your explanation and clarification.
Yes it helps.

You put together all my knowledge and confirm it. ;)

Of course, I could use docker for installing redis. But i have limitations on production server.
This is first point. Second is: I need to monitoring it, updating it. So mantaining it. ;(

Some more questions:

  1. You wrote that redis is used for caching permissions ....

Identity server is central point for checking credetials, generating tokenc, etc. Right ?
It wouldn't by nice if identity server has a cache for caching all that requests ?
Yes maybe this is not good enought for extra large systems. But for small to middle.. ?
It Will bi simpler to deploy, maintain and less compex.

  1. How redis fits in permission checkig flow ? I mean: who store permissions into redis ?
    Identity server or micro service ? How long this key stays in cache ?

  2. Have you some information about redis integration implementation in code ?
    I mean: Is this bassicaly ASP.NET Core code extendet with ABP or pure ABP ?

Thanks for advance.

Edvin

I advice you create normal asp.net core website do tests on redis and once you make a decision to use redis, you can enable it.

Otherwise you can disable it in abp, its and optional. Sounds like you want someone to prove to you why use redis yet its optional and depends with what you are doing in your project.

@dicksonkimeu

I want to use indetity service as separate service.
I just want to get big picture how redis is integrated into ABP. How and when should i use it.
I need to advice admins on customer's production environment why we need redis, how to configure and maintain it, etc

In ABP docs there is only one sentence. Redis is required. And this is it.

I hope, guys in ABP are goint to make some docs about it.

Its not how redis is integrated to ABP. Nothing special on ABP. Its about redis and asp.net core.

Create a asp.net core project (without abp) and test how redis works.

@dicksonkimeu

Ok. Thanks. I know nothing about redis.
Where i can start ? What do you suggest ?

Nothing special on ABP.

Maybe. But they create template which requires redis.
So i expect they explain how they use it and why.

@gterdem Thanks for your explanation and clarification.
Yes it helps.

You put together all my knowledge and confirm it. ;)

Of course, I could use docker for installing redis. But i have limitations on production server.
This is first point. Second is: I need to monitoring it, updating it. So mantaining it. ;(

Some more questions:

  1. You wrote that redis is used for caching permissions ....

Identity server is central point for checking credetials, generating tokenc, etc. Right ?
It wouldn't by nice if identity server has a cache for caching all that requests ?
Yes maybe this is not good enought for extra large systems. But for small to middle.. ?
It Will bi simpler to deploy, maintain and less compex.

  1. How redis fits in permission checkig flow ? I mean: who store permissions into redis ?
    Identity server or micro service ? How long this key stays in cache ?
  2. Have you some information about redis integration implementation in code ?
    I mean: Is this bassicaly ASP.NET Core code extendet with ABP or pure ABP ?

Thanks for advance.

Edvin

With signalR how can I use redis to share connection between multiple instance.
I have read this document. But I don't know how to implement it with abp.io
https://docs.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-3.1

I am very appreciate if someone explain them.

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.

Was this page helpful?
0 / 5 - 0 ratings