-
Notifications
You must be signed in to change notification settings - Fork 28
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
Extremely slow django migrations to cloud spanner and fails half way. #756
Comments
@vi3k6i5 Could please help me understand if am I doing something wrong or its just spanner. |
@jeetpatel9, looking at this line As I see, using any transactions API will not work here, as Spanner DDLs are working outside transactions. @vi3k6i5, looks like our backend needs |
Thanks @IlyaFaer : Will look into doing that, Thanks @jeetpatel9 from bring it to attention. For now a solution that I can recommend is running the migration and the spanner instance on GCP. Running Django app on local and running spanner on GCP significantly adds to network delays causing issues. Also try tuning I will investigate Illya's suggestion more and get back with a solution. |
@jeetpatel9 : can you try with these settings. NOTE: For the right value for @IlyaFaer : I did not see any major gains in performance with |
@vi3k6i5 I tried with I also ran the migrations as a job in Kubernetes cluster which is in the same region as the spanner instance and it still took 7 hours and 15 mins to finish migrating 42 tables. NOTE: I deleted all the previous migration files and created new one to reduce the number of queries. The only difference is if |
Would it be possible to share the table structure which is slowing the progress? Also try a basic empty django app see if that is also slow for you, this generally wraps up in under 10 mins for me. |
Generally each table is taking significant amount of time but the longest is when the indexes of the tables are being created. I tried a basic Django app with 4 tables and no indexes at all. It took around 15 mins. Also, in most cases I get this DeadlineExceeded issue and the migrations are rarely successful. The last time I ran the migrations, this error was thrown while applying below shown migration. Also it doesn't break every time at exactly this point, it throws this error usually after applying 10-14 migrations.
|
I'm actually seeing the same issue on a brand new deployment. Sorry to bring this old-ish thread back to life |
Hello everyone,
I am trying to set up my Django project with
Cloud Spanner
. I did everything as told in the documentation like adding the app into installed apps list -INSTALLED_APPS = ['django_spanner',]
, database configuration insettings.py
after creating spanner instance & database. Then created a service account with the appropriate permissions & at last set the environment variables with the service account key & project id as shown below.So far I am able to connect to the spanner instance when I spin up my project but when I run
python manage.py migrate
it takes like 10-20 mins to create 3-4 tables in the database. I waited long, around 30 mins to see if it could finish but after creating few more table it failed.I don’t know if this makes any difference but the instance I created is in Mumbai region and I am 300 KM away running my application locally inside a docker container. Also the spanner instance is regional & has only 1 node. I think it is good enough to run the migrations which would create around 30 tables.
Here the complete traceback of what I am seeing -
The text was updated successfully, but these errors were encountered: