dcart1234
dcart1234

Reputation: 519

Django Log File vs MySql Database

So I am going to be building a website using the Django web framework. In this website, I am going to have an advertising component. Whenever an advertisement is clicked, I need to record it. We charge the customer every time a separate user clicks on the advertisement. So my question is, should I record all the click entries into a log file or should I just create a Django model and record the data into a mysql database? I know its easier to create a model but am worried if there is a lot of high traffic to the website. Please give me some advice. I appreciate you taking the time to read and address my concerns.

Awesome. Thank you. I will definitely use a database.

Upvotes: 0

Views: 579

Answers (2)

dm03514
dm03514

Reputation: 55962

You should save all clicks to a DB. A database is created to handle the kind of data you are trying to save.

Additionally, a database will allow you to analyze your data a lot more simply then a flat file. If you want to graph traffic from country, or by user agent or by date range, this will be almost trivial in a database, but parsing giganitc log files could be more involving.

Also a database will be easier to extend. Right now you are just tracking clicks but what happens if you want to start pushing advertisements that require some sort of additional user action or conversion. You will be able to extend this beyond clicks extremely easy in a database.

Upvotes: 1

Laur Ivan
Laur Ivan

Reputation: 4177

Traditionally, this sort of interactions is stored in a DB. You could do it in a log, but I see at least two disadvantages:

  1. log rotation
  2. the fact that after logging you'll still have to process the data in a meaningful manner.

IMO, you could do it in a separate DB (see the multiple db feature in django). This way, you could have the performance somewhat more balanced.

Upvotes: 1

Related Questions