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

Add electric-sql to the client-side-databases project to measure the performance metrics. #5589

Open
mattriese opened this issue Feb 2, 2024 · 17 comments

Comments

@mattriese
Copy link

Add electric-sql to the client-side-databases project to measure the performance metrics.

For that, create an angular subproject like the already existing ones and then implement the logic interface.

I plan to be done with this on Feb 11th.

@pubkey
Copy link
Owner

pubkey commented Feb 2, 2024

Thank you @mattriese
Let me write down a few notes that might help you:

  • In the client-side-db project, each implementation uses the same angular components and setup. Only the logic-interface is different for each implementation. For example the pouchdb logic is here: https://github.com/pubkey/client-side-databases/blob/master/projects/pouchdb/src/app/app.logic.ts This is the crucial part to make it work, so for electric-sql, you have to implement that logic via electric instead of pouchdb.

  • All subprojects use the same e2e test suite, so when you have implemented the logic, you can add a test:electric-sql script and run that (see package.json for the other scripts)

  • Adding backend replication would be great but is NOT required. Having only implemented the client side part is also ok.

  • Do not forget to add the electric test scripts to the CI

@mattriese
Copy link
Author

udpate: I would like another couple weeks to finish this.

@pubkey
Copy link
Owner

pubkey commented Feb 13, 2024

@mattriese No problems, thanks for the update.

@mattriese
Copy link
Author

Update:
I have a first pass at translating the logic to use electric-sql and setting up the scripts so the project will run.
But the auto-generated typescript electric-sql client is being generated with many typescript errors, so it won't build. I asked about this in the electric-sql discord today but haven't got a response yet. If I don't hear back about that I will try manually fixing the type issues when I have some time this week.

How will I make a PR when it is working? will you grant me write access to this repo?

Also, when I try to run the projects in this repo and use them in the browser, only the Firebase projects works. And it only fully works in production mode. In dev mode it does not load the chat history, but I can add new messages. All the other projects get stuck on the loading spinner after I enter my name. (I haven't tried the AWS project because of the extra steps).
I'm not sure what the problem is, but PouchDB, WatermelonDB, Dexie, and Loki all have an error on the server related to ng-cli-ws, like '"GET /ng-cli-ws" Error (404): "Not found"'
PouchDB and WatermelonDB get the "user document not found" log in the client.

The e2e tests do seem to run fine, though.

@pubkey
Copy link
Owner

pubkey commented Feb 26, 2024

How will I make a PR when it is working?

Just make a single PR and I will merge it.

For your problems, maybe you want to clear the browser state in the "applications" tab in the dev tools. That might help. The projects build in the CI and the tests work, so it should be also working for you.

@mattriese
Copy link
Author

The electric-sql folks have a couple PRs to fix the type issues, I will give it another try when those are merged and published.

@pubkey
Copy link
Owner

pubkey commented Feb 28, 2024

Hi @mattriese
thanks for the update, lets wait for them to fix that.

Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem. Notice that only bugs in the rxdb premium plugins are ensured to be fixed by the maintainer. Everything else is expected to be fixed by the community, likely you must fix it by yourself.

@stale stale bot added the stale label Mar 13, 2024
@pubkey pubkey removed the stale label Mar 25, 2024
@pubkey
Copy link
Owner

pubkey commented Mar 25, 2024

@mattriese the PRs at the electric repo seem to be fixed/closed.

@mattriese
Copy link
Author

Ah yeah, I just noticed they released it with electric-sql@0.9.5. I'll try to wrap this up this week

@mattriese
Copy link
Author

I've created a draft PR to show my progress so far. There's a sqlite error when I try to load the app and the tests seem to have another problem. Any advice would be appreciated :)
I'm hoping to hear back from the electric-sql discord channel about the sqlite error soon.

Copy link

stale bot commented Apr 15, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem. Notice that only bugs in the rxdb premium plugins are ensured to be fixed by the maintainer. Everything else is expected to be fixed by the community, likely you must fix it by yourself.

@stale stale bot added the stale label Apr 15, 2024
@mattriese
Copy link
Author

mattriese commented Apr 16, 2024

I solved one of the problems and narrowed down the cause of the other. see the new comments in the PR

If you have any wisdom around loading wasm files in a way that's compatible with Angular and testCafe, please let me know! :)

@stale stale bot removed the stale label Apr 16, 2024
@pubkey
Copy link
Owner

pubkey commented Apr 16, 2024

@mattriese On some projects I am spawning a different server just to serve static files to testcafe browsers. I am not sure if that is the only possible solution. Maybe bundling the wasm file into a base64 is an option, but that might impact the performance results.

@mattriese
Copy link
Author

@pubkey Ok thanks for the suggestions I will give it a shot

Copy link

stale bot commented Apr 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem. Notice that only bugs in the rxdb premium plugins are ensured to be fixed by the maintainer. Everything else is expected to be fixed by the community, likely you must fix it by yourself.

@stale stale bot added the stale label Apr 29, 2024
@mattriese
Copy link
Author

Update: I didn't get any responses to my question in the Electric-SQL discord about this issue. I tried the suggestion of spawning a separate express server just to serve the wasm files, and that did work in dev mode but when running the tests I got the same error (TypeError: cannot read properties of undefined. reading "durability"). I didn't try the suggestion of bundling the wasm into base64.
Unfortunately, I have run out of bandwidth to keep trying to fix this bug. Maybe someone else can take over from here. I hope once the bundling/testcafe issue is fixed, it will be pretty close to being done. I'd be happy to jump back in if that problem is fixed and there are questions or issues with my implementation of electric-sql.

@stale stale bot removed the stale label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants