design question


T

Tim Arnold

This is a question about system design I guess. I have a django
website that allows users to change/view configuration details for
documentation builds. The database is very small. The reason I'm using
a database in the first place is to make it easy for users to change
the configuration of their builds. Django makes that easy and I can go
on to other problems, like actually building the documentation.

During a build, I query the configuration database at different times
to get the configuration I need, which results in several calls to the
database at different points of the build process.

It doesn't feel right that I'm making these calls at different times.
I *could* make a single big call at the beginning of the build,
basically serializing all the config data I could need into a
dictionary or maybe a json structure. And just pass that structure
around as needed during the build, with no more database calls needed.

These builds take from a few minutes to an hour or so, with the time
spent making db calls almost insignificant. So if time isn't a
problem, am I wringing my hands over something that really doesn't
matter much? I guess it just doesn't feel like the right thing to me.

thanks,
--Tim
 
Ad

Advertisements

K

Kev

Tim said:
This is a question about system design I guess. I have a django
website that allows users to change/view configuration details for
documentation builds. The database is very small. The reason I'm using
a database in the first place is to make it easy for users to change
the configuration of their builds. Django makes that easy and I can go
on to other problems, like actually building the documentation.

During a build, I query the configuration database at different times
to get the configuration I need, which results in several calls to the
database at different points of the build process.

It doesn't feel right that I'm making these calls at different times.
I *could* make a single big call at the beginning of the build,
basically serializing all the config data I could need into a
dictionary or maybe a json structure. And just pass that structure
around as needed during the build, with no more database calls needed.

These builds take from a few minutes to an hour or so, with the time
spent making db calls almost insignificant. So if time isn't a
problem, am I wringing my hands over something that really doesn't
matter much? I guess it just doesn't feel like the right thing to me.

thanks,
--Tim

Hello Tim,

Given the times that you've quoted for the documentation builds, a few
microseconds here and there for database queries doesn't really matter.

The Django docs, as it happens, look favourably on doing one query up
front,
(http://docs.djangoproject.com/en/1.1/topics/db/optimization/#topics-db-optimization),
but they also recommend profiling first, which would presumably
highlight the insignificance of your queries compared with the duration
of the builds.

So I think the upshot is don't worry about it, or if you must,
accept that you're worrying more about aesthetics than anything else
(not that aesthetics aren't important).

Cheers,

Kev
 
A

Alf P. Steinbach

* Tim Arnold:
This is a question about system design I guess. I have a django
website that allows users to change/view configuration details for
documentation builds. The database is very small. The reason I'm using
a database in the first place is to make it easy for users to change
the configuration of their builds. Django makes that easy and I can go
on to other problems, like actually building the documentation.

During a build, I query the configuration database at different times
to get the configuration I need, which results in several calls to the
database at different points of the build process.

It doesn't feel right that I'm making these calls at different times.
I *could* make a single big call at the beginning of the build,
basically serializing all the config data I could need into a
dictionary or maybe a json structure. And just pass that structure
around as needed during the build, with no more database calls needed.

These builds take from a few minutes to an hour or so, with the time
spent making db calls almost insignificant. So if time isn't a
problem, am I wringing my hands over something that really doesn't
matter much? I guess it just doesn't feel like the right thing to me.

Re efficiency it seems to be a complete non-issue, but correctness is much more
important: is there any way that the config details can be (inadvertently)
changed while the build is going on?

If so then it might be a good idea to read all relevant info up front (holding a
lock for hours seems ungood to me).


Cheers & hth.,

- Alf
 
B

Bruno Desthuilliers

Alf P. Steinbach a écrit :
(snip)
Re efficiency it seems to be a complete non-issue, but correctness is
much more important: is there any way that the config details can be
(inadvertently) changed while the build is going on?

+1
 
Ad

Advertisements

T

Tim Arnold

Alf P. Steinbach a écrit :
(snip)


+1

Thanks everyone, I'm new at this type of development so it helps to
get input from folks who know what they're talking about. I'm just
been coding and doing what is right in my own eyes...

There is almost no way for the configuration to change during a build,
so it looks like I was just worrying about something that doesn't need
worry.

Now on to the things that do!

thanks again,
--Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top