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

Offload database management to secondary database, thinking about hyperdb, ludicrousdb. #1360

Open
saas786 opened this issue Aug 25, 2022 · 3 comments

Comments

@saas786
Copy link

saas786 commented Aug 25, 2022

Feature Request

As I see you are already using \WP_Stream\DB_Driver_WPDB, which can be be made pluggable.

ref: https://github.com/xwp/stream/blob/3.9.1/classes/class-db-driver-wpdb.php#L13

So for starters, something like this:

before:

public function __construct() {
...
		global $wpdb;
		$prefix = apply_filters( 'wp_stream_db_tables_prefix', $wpdb->base_prefix );
...
}

after:

public function __construct() {
...
		global $wpdb;
		
		$custom_$wpdb = apply_filters( 'wp_stream_db_tables', $wpdb );
		$prefix = apply_filters( 'wp_stream_db_tables_prefix', $custom_$wpdb->base_prefix );
...
}

ref: https://github.com/xwp/stream/blob/3.9.1/classes/class-db-driver-wpdb.php#L41

So where ever $wpdb is referenced, we could replace it if needed.

Reason

We have about 15 million entries for Stream, which is not ideal, slows down our website significantly, so would like it to be offloaded, so it can store / retrieve data from secondary database.

Loom_MSiJQj5Ptk

@lkraav
Copy link
Contributor

lkraav commented Aug 25, 2022

slows down our website significantly

Where is this coming from? Queries are indexed and have very little effect on page build speed.

@saas786
Copy link
Author

saas786 commented Aug 25, 2022

slows down our website significantly

Where is this coming from? Queries are indexed and have very little effect on page build speed.

This might not apply to your website.

But not everyone has the luxury of using Powerful Servers, Indexing, Redis or such caching tools on their hands.

Majority of users are on shared hosting, with not access to caching tools like Redis etc.

So offloading logging to secondary database is necessary for the most users.

@lkraav
Copy link
Contributor

lkraav commented Aug 25, 2022

So offloading logging to secondary database is necessary for the most users.

Those most users would highly likely also lack the capability to work with any secondary database.

But let's see what Stream team thinks here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants