Starts in:
0 DAY
18 HRS
12 MIN
57 SEC
Starts in:
0 D
18 H
12 M
57 S
Open Closed

Reporting solution #3987


User avatar
0
akaziuka created

We're looking to create a proper reporting solution on top of a tiered ABP template/application. We're not interested in searching/evaluating reporting components per se at this stage, but rather we're looking for a general approach to organizing reporting. Here are some inputs/given:

  • The initial migration provisions four distinct databases for a solution (Identity management, Tenant mgmt, Application database, etc.)
  • Every tenant in our app may have their own (separate) database instance (separate database, separate schema approach)
  • The initial solution has a public site and the back-office part (for tenant/permission/feature management etc.)

We need to build some simple tenant-specific reports. Let's take the "file upload" functionality as a hypothetical example. Tenants need to know how many files they have uploaded daily/monthly/annually, etc. In this case, reporting is not a big deal as we can query this data from the tenant's database context. Reporting becomes a problem when we have hundreds of tenants with their own/dedicated database, and we (as a service provider) need to gather aggregated data from all those tenants (and display it on the back-office site). What's the recommended approach in this case? Creating a Data Warehouse? Also, querying against the live transactional DB is not a good idea, given that report generation may spoil the user experience and affect the app's performance. For this matter, a read-only replica for reporting solution would be a better idea, but it doesn't help much with many tenants who have a dedicated database. What's ABP's recommendation here?


5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Why not create a reporting service(module), it has a separate database or NoSQL database, like Elasticsearch? in this way you don't have to query hundreds of tenant databases to get reports.

    About performance,

    You can create a background worker to generate reports periodically, when you query, it's ready immediately. (not used for real-time reporting)

  • User Avatar
    0
    akaziuka created

    Hi,

    Why not create a reporting service(module), it has a separate database or NoSQL database, like Elasticsearch? in this way you don't have to query hundreds of tenant databases to get reports.

    About performance,

    You can create a background worker to generate reports periodically, when you query, it's ready immediately. (not used for real-time reporting)

    Hi! Could you elaborate on the first option, please? I didn't quite get how we benefit from the separate service + database (or ElasticSearch service). Do you have any useful links/references that may help us clarify this approach? Thanks!

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    With independent services, the reporting module is more like an infrastructure, you can use it anywhere.

    When you have hundreds of tenant independent databases, it's not good to query this data from the tenant's database context. It is better to use a separate database table for reporting.

    Do you have any useful links/references that may help us clarify this approach

    Sorry, I don't have such links. it's more like our audit logging module, you can check it.

  • User Avatar
    0
    akaziuka created

    Hi, How do we ensure that the data from many Tenant's databases go to Elasticsearch?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    You can use the event bus (domain event or your custom event) to save data to DB or Elastic search.

    If you already have some data, then you may need to do a data migration.

    We have some usage of elasticsearch: https://github.com/abpframework/abp/blob/dev/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/DocumentChangedEventHandler.cs https://github.com/abpframework/abp/blob/dev/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06