[bitbake-devel] [PATCH 16/94] bitbake: webhob: disable synchronous sqlite connection
Alex DAMIAN
alexandru.damian at intel.com
Tue Sep 24 16:51:45 UTC 2013
From: Alexandru DAMIAN <alexandru.damian at intel.com>
SQLite has very bad INSERT performance in synchronous mode.
We disable the synchronous mode to improve performance only
on sqlite connections.
This requires also to change the way the build info
wrapper loads the Django settings.
Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
bitbake/lib/bb/ui/buildinfohelper.py | 3 +--
bitbake/lib/webhob/whbmain/settings.py | 10 ++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 6f3b5c2..e12750e 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -366,9 +366,8 @@ class BuildInfoHelper(object):
self.orm_wrapper = ORMWrapper(server)
def configure_django(self):
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webhob.whbmain.settings")
import webhob.whbmain.settings as whb_django_settings
- from django.core.management import setup_environ
- setup_environ(whb_django_settings)
# Add webhob to sys path for importing modules
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'webhob'))
diff --git a/bitbake/lib/webhob/whbmain/settings.py b/bitbake/lib/webhob/whbmain/settings.py
index cd9dbe8..aa1d4fc 100644
--- a/bitbake/lib/webhob/whbmain/settings.py
+++ b/bitbake/lib/webhob/whbmain/settings.py
@@ -20,6 +20,16 @@ DATABASES = {
}
}
+# If we're using sqlite, we need to tweak the performance a bit
+from django.db.backends.signals import connection_created
+def activate_synchronous_off(sender, connection, **kwargs):
+ if connection.vendor == 'sqlite':
+ cursor = connection.cursor()
+ cursor.execute('PRAGMA synchronous = 0;')
+connection_created.connect(activate_synchronous_off)
+#
+
+
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
--
1.8.1.2
More information about the bitbake-devel
mailing list