2

I am writing a web application for mapping Real-time GPS coordinates on Google maps coming from a GPS device, for fleet managment.

Since the flow of data is very fast from the GPS device to web application for database it becomes very heavy and the database is being queried every 5 seconds(via AJAX from web browser running the website) it becomes more heavy.

Keeping the updates in real-time is becoming very difficult a lagging of 30 seconds to 60 seconds is created between the actually update and its visibility on the website.

I am using Django + Apache + MySQL on CentOS 6.4 64 bit.

Any advice in what direction i should move to make the processing/visibility of data in more real-time would be helpful.

akm
  • 830
  • 6
  • 20
  • How about [**HTML 5 WebSockets**](http://www.html5rocks.com/en/tutorials/websockets/basics/)? – ascx Feb 26 '14 at 10:04
  • @Socialz how could changing the client will make any performance upgradation on server hand? – akm Feb 26 '14 at 10:49
  • I'd like to refer you to read [**this**](http://stackoverflow.com/questions/10028770) fancy topic on this subject. – ascx Feb 26 '14 at 10:52

2 Answers2

0

I would suggest you to use NoSql database like MongoDB. It would really help you to achieve real time application performance.

Have a look at Django-With-MonoDB.

And if possible try to replace default python interpreter to PyPy.

I think these two are enough to give you best performance. :)

Understanding Django-using-PyPy

Also for front-end you should use KnockoutJS or AngularJS.

CrazyGeek
  • 3,397
  • 2
  • 24
  • 38
  • 1
    How PyPy will make a difference ? Please tell me how can i make relation in a nosql DB ? – akm Feb 26 '14 at 10:47
  • PyPy use JIT if you read the above mentioned links than you come to know about it(Just checkout the benchmark with django http://speed.pypy.org/timeline/?exe=1&base=2%2B35&ben=django&env=tannit&revs=1000 ) And In NoSQL, you don't design your database based on the relationships between data entities. You design your database based on the queries you will run against it. – CrazyGeek Feb 26 '14 at 10:54
  • I have added more info in my answer and voted up your question. Thanks. – CrazyGeek Feb 26 '14 at 11:04
0

Some tipps:

  • Avoid xml, especially a DOM based xml parser (this blows up data by a factor of 100). (A lat long coordinate without time, needs 8 bytes, not more)
  • favor a binary represenattion of the coordinates, and parse them by hand, instead using an slow generated parsing code taht probaly uses reflection to parse.
  • try to minimize the use of databases, especially relational ones. raise the intervall that clients are sending: e.g evry 20min instead evry 5.
  • if you use a db, minimize the transactions, try to do all processing in one transaction.
AlexWien
  • 28,470
  • 6
  • 53
  • 83