MajMcCloud / TelegramBotFramework

This is a context based application framework for the C# TelegramBot library.
https://www.t.me/tgbotbase
MIT License
149 stars 43 forks source link

How session serializer works? #47

Closed mottaghipour closed 10 months ago

mottaghipour commented 10 months ago

How session serializer works?

I want to develop my own session serializer with mongodb.

mottaghipour commented 10 months ago

I have a big telegram bot with 100,000 users.

I think sessions without db may be use a lot of hardware.

MajMcCloud commented 10 months ago

Hey,

check out the readme part about it: https://github.com/MajMcCloud/TelegramBotFramework#istatemachine

You can take a look as well to the existing state machines like the SimpleJSONMachine (https://github.com/MajMcCloud/TelegramBotFramework#simplejsonstatemachine) or the XMLStateMachine (https://github.com/MajMcCloud/TelegramBotFramework#xmlstatemachine)

And for sure the Microsoft SQL Server Extension nuget package: https://github.com/MajMcCloud/TelegramBotFramework/tree/master/TelegramBotBase.Extensions.Serializer.Database.MSSQL

mottaghipour commented 10 months ago

Hi :)

Do we save all the data and then load it all?

A lot of memory is needed for this.

How can we optimize memory usage?

MajMcCloud commented 10 months ago

This depends on what your meaning with "all data". Actually it saves only the chat id (called DeviceId) and the last message and what you are having in your form as properties for sure.

Not sure what else can be optimized.

mottaghipour commented 10 months ago

this is good. I need to work more on dividing the forms.

mottaghipour commented 10 months ago

Thank you for your answer :)