Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Moved Tenant Information to Redis for quick access #33309

Merged
merged 20 commits into from May 15, 2024

Conversation

NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented May 9, 2024

Description

The tenant is fetched multiple times across the appsmith codebase but is rarely updated (from the admin settings). Every time a fetch call to the database is costly both in terms of resources and time taken.
The consolidated api also makes a call to fetch the tenant and return to the client. To improve the performance of fetching the tenant information, we are moving the tenant information to redis cache for quicker fetch.
This will improve the performance of the consolidated api and also reduce the time taken by all the different functionalities within the backend codebase which depend on tenant to process further.

TL;DR
Adds tenant information tenantService.getDefaultTenant() to redis.

Fixes #33083

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9079438120
Commit: 306e77f
Cypress dashboard url: Click here!

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

@NilanshBansal NilanshBansal self-assigned this May 9, 2024
@github-actions github-actions bot added Enhancement New feature or request Integrations Pod Issues related to a specific integration Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Task A simple Todo labels May 9, 2024
Copy link

github-actions bot commented May 9, 2024

Failed server tests

  • com.appsmith.server.services.ce.TenantServiceCETest#setEmailVerificationEnabled_WithValidSMTPHost_Success
  • com.appsmith.server.services.ce.TenantServiceCETest#setMapsKeyAndGetItBack
  • com.appsmith.server.services.ce.TenantServiceCETest#updateTenantConfiguration_updateStrongPasswordPolicy_success

Copy link

github-actions bot commented May 9, 2024

Failed server tests

  • com.external.plugins.RestApiPluginTest#testHttpGetRequestRawBody

@NilanshBansal NilanshBansal changed the title feat: Adding & Fetching Tenant Configuration to Redis feat: Adding & Fetching Tenant Info to Redis May 9, 2024
@NilanshBansal NilanshBansal changed the title feat: Adding & Fetching Tenant Info to Redis feat: Moved Tenant Information to Redis for quick access May 9, 2024
Copy link

github-actions bot commented May 9, 2024

Failed server tests

  • com.appsmith.server.services.ce.TenantServiceCETest#setEmailVerificationEnabled_WithValidSMTPHost_Success
  • com.appsmith.server.services.ce.TenantServiceCETest#updateTenantConfiguration_updateStrongPasswordPolicy_success
  • com.appsmith.server.solutions.ApplicationForkingServiceTests#cloneApplicationForkWithConfigurationFalseWithActionsThrice

@NilanshBansal NilanshBansal requested a review from abhvsn May 10, 2024 03:39
…ervices/ce/TenantServiceCEImpl.java

Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Copy link

Failed server tests

  • com.appsmith.server.services.ce.ApplicationServiceCETest#testUploadNavigationLogo_invalidImageSize
  • com.appsmith.server.services.ce.TenantServiceCETest#setEmailVerificationEnabled_WithValidSMTPHost_Success
  • com.appsmith.server.services.ce.TenantServiceCETest#updateTenantConfiguration_updateStrongPasswordPolicy_success

Copy link

Failed server tests

  • com.appsmith.server.services.ce.TenantServiceCETest#setEmailVerificationEnabled_WithValidSMTPHost_Success
  • com.appsmith.server.services.ce.TenantServiceCETest#updateTenantConfiguration_updateStrongPasswordPolicy_success

@NilanshBansal
Copy link
Contributor Author

NilanshBansal commented May 10, 2024

Test updateTenantConfiguration_updateStrongPasswordPolicy_success is failing weirdly with 2 different tenantIds getting populated in redis for a single test case. This is creating inconsistency and leading to failure of this test 😞

image

@appsmithorg appsmithorg deleted a comment from github-actions bot May 13, 2024
@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label May 13, 2024
abhvsn
abhvsn previously requested changes May 13, 2024
Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NilanshBansal added couple of minor comments. Also we are updating the tenant in restartTenant which is making a call to BaseService and not covered as a part of invalidation. I'm little concerned on invalidation part, let's make sure to override the base service and repository methods which are saving and updating the DB object.

@NilanshBansal NilanshBansal requested a review from abhvsn May 14, 2024 04:55
Copy link

Failed server tests

  • com.appsmith.server.services.ce.ApplicationServiceCETest#testUploadNavigationLogo_invalidImageSize
  • com.appsmith.server.solutions.ApplicationForkingServiceTests#cloneApplicationForkWithConfigurationFalseWithActionsThrice

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

@NilanshBansal NilanshBansal merged commit 306e8c1 into release May 15, 2024
82 checks passed
@NilanshBansal NilanshBansal deleted the feature/issue-33083/tenant-config-to-redis branch May 15, 2024 01:45
hetunandu pushed a commit that referenced this pull request May 15, 2024
## Description
After merging the PR #33309,
we started to store the Tenant Information in the Redis cache. Redis
needs to serialize the objects upon storing and deserialize post
fetching.
To do that we need to implement serialization for all the nested user
defined Domains.
This was missed for the LicenseCE and Payment object.
Corresponding EE PR:
appsmithorg/appsmith-ee#4191

Fixes #33486   

## Automation

/ok-to-test tags="@tag.Settings, @tag.LicenseAndBilling"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9096922670>
> Commit: 559bcd6
> Cypress dashboard: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9096922670&attempt=3&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank"> Click here!</a>
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/ProductRamps/PrivateEmbedRamp_spec.ts
</ol>
> To know the list of identified flaky tests - <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">Refer here</a>

<!-- end of auto-generated comment: Cypress test results  -->






## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
NilanshBansal added a commit that referenced this pull request May 16, 2024
@NilanshBansal NilanshBansal restored the feature/issue-33083/tenant-config-to-redis branch May 21, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Issues related to a specific integration ok-to-test Required label for CI Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Implement Redis caching for tenant configuration
4 participants