-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support for Google App Engine in Read Only Mode #9
base: master
Are you sure you want to change the base?
Conversation
…low GAE users to create a semidbm database offline, then upload it to GAE, and then use that database in read-only mode within GAE. Google App Engine runs python in a sandbox, and does not support os file descriptor access that is used by semidbm. It also does not support opening files for writing (but it does support read only). This commit changes those function calls to the standard python open, read, and write functions, which are supported in the GAE sandbox. Further, if the semidbm database is opened in read-only mode, then the appropriate flags are used which work on GAE.
Looks like I need to do some fixing for python 3. Please let me know if this PR is generally acceptable and I'll clean up the python 3 issues. |
I believe the main reason the lower level I would not be opposed to this change provided the benchmark numbers from that script don't change significantly. Also, I'm not really familiar with google app engine. You're saying that |
Yes, I can confirm that The two main changes I made were to remove the Below is the benchmarking data and semidbm still has good numbers. I did not include
|
Could you post the benchmark for semidbm on your machine against the upstream master branch? It would be helpful to see what the numbers are on your machine before/after the change, but I'm only seeing the semidbm benchmark numbers once (I'm assuming those are the numbers with your changes included?). |
Good point. They're below and it looks like a mixed bag. With Changes
Without changes
|
Also... I'm running on Windows 10. I would not be surprised if these numbers were different on other systems. |
Here's what I get on a macbook: Before
After
Here's the percentage increases with this change on my machine (lower is better, negative means benchmark was faster not slower):
Given that this increases perf significantly for 4/7 benchmarks I don't think this change can be merged as is. If you can get the perf difference to single digit percentages I'd be ok with merging. |
The Problem
There is often a need on Google App Engine to have a simple read-only database or key value store. This comes up when one wants to store a large dictionary of information which does not need to be updated very often. Examples include timezone data, list of state or country capitals, annual financial information, or any database that only needs to be updated once every few years.
Storing this information in a python dictionary is an option, but would be memory inefficient, especially if used infrequently. Storing it in the GAE datastore can be complex to maintain. Storing it in the GAE memcache is not acceptable because it is transient.
The Solution
A simpler solution is to build a database offline, then upload it to GAE, and then access the database on GAE in read only mode. This commit allows a user of
semidbm
to do just that.How
Google App Engine runs python in a sandbox, and does not support
os
file descriptor access that is used bysemidbm
. It also does not support opening files for writing, but it does support read only access.This commit changes those function calls to the standard python
open
,read
, andwrite
functions, which are supported in the GAE sandbox. Further, if thesemidbm
database is opened in read-only mode, then the appropriate flags are used which work on GAE.I have run the tests on this PR, and they all pass.