Jump to content

Issues with using a remote database


tinacious
 Share

Recommended Posts

Hi all, I've had some issues during the migration process with using a remote database including login and performance issues. I was wondering if there were specific measures to take into account when using a remote database.

My first issue is the performance. I noticed that now since I've been using a remote database that the site takes longer to load. Is there anything I can do to improve the site performance like cache the database or anything? Everything is very slow, especially in the admin pages when loading the pages list, editing an item, etc.

My other issue was not being able to log in to the site. I would get the "Login failed" error and sometimes "This request was aborted because it appears to be forged."

I have tried a number of suggestions I've found on the forums including making sure my assets folder has permissions 777, deleting the contents of /assets/sessions/, changing the session name to $config->sessionName = session_name(); or just commenting it out altogether. None of these worked.

This was the line in my config.php that worked:

$config->protectCSRF = false;

With that suggestion also came the disclaimer that it may not be the best approach. I want to use best practices so would like to know what the best way for working with remote databases securely would be?

Thanks for your help.

Link to comment
Share on other sites

Disabling the CSRF is likely to fix some issues that can occur with sessions and cookies. Are there any other important features or quirks with the hosting environment that you're aware of? Have you used the same service before?

Sometimes hosting environments do weird things with the way they handle sessions. One option to look at is to use the "Session Handler Database" module. It should be present in your PW install, and just needs Installing. However, it will be using the database now instead of local files - which comes back to the performance problem you mentioned :)

Whenever the website is hosted away from the database on separate networks, the more likely it is that it will be slower. Template caching might help in terms of the front-end, but not for the admin pages.

PW's database caching ($config->dbCache in config.php) is set to true by default, so changing that is unlikely to help.  What is the reason for using a remote database in this instance? Are there any other alternatives or different configurations that are available?

  • Like 1
Link to comment
Share on other sites

I've used a remote database before and saw some slowdown, but not major. Is the connection is going through a consumer link (cable, DSL, etc.)? If so, that may not be practical for a production site. Otherwise, I'd think it should work, even if not ideal. Most hosts don't open up their MySQL for outside connections, so if you are using one that does, it might be good to check with them to see what they suggest in terms of ideal settings. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...