Put your views on different design documents in couchDB in order to bypass whole DB lock for indexing. Be cautious that if your database has huge amount of data there will be an hourly lock on couchiDB on all operations!!!
So for example if you have couchDB view on:
http://YOUR_IP:5984/_utils/#/database/YOUR_DATABASE/_design/query/_view/THIS_IS_YOUR_VIEW
Put your view that is on a different category like below:
http://YOUR_IP:5984/_utils/#/database/YOUR_DATABASE/_design/NEW_DESIGN_DOCUMENT/_view/THIS_IS_YOUR_VIEW
This simple trick will prevent database lock on whole operations, the change wiill at least does not affect other views operations.
#couchdb #database #performance #lock #indexing
So for example if you have couchDB view on:
http://YOUR_IP:5984/_utils/#/database/YOUR_DATABASE/_design/query/_view/THIS_IS_YOUR_VIEW
Put your view that is on a different category like below:
http://YOUR_IP:5984/_utils/#/database/YOUR_DATABASE/_design/NEW_DESIGN_DOCUMENT/_view/THIS_IS_YOUR_VIEW
This simple trick will prevent database lock on whole operations, the change wiill at least does not affect other views operations.
#couchdb #database #performance #lock #indexing
It is sometimes tempting to log less in order to let's say improve performance or save disk space, and blah blah blah!
Loggers in python are the last thing to think about when you think about performance. You can place log ratote to use less disk space. From my own experience log as much as you can. Log as every step necessary to make log level verbose. At last in case you think you application is very stable you change log level to info, and all debug logs are ignored.
It took sometimes hours to debug a few modules (in microservice structure) to find the culprit, something that could have been solved by putting more logs.
Log, log and log more...
#python #log #logger #performance
Loggers in python are the last thing to think about when you think about performance. You can place log ratote to use less disk space. From my own experience log as much as you can. Log as every step necessary to make log level verbose. At last in case you think you application is very stable you change log level to info, and all debug logs are ignored.
It took sometimes hours to debug a few modules (in microservice structure) to find the culprit, something that could have been solved by putting more logs.
Log, log and log more...
#python #log #logger #performance
tuples
vs list
from a different point of view. Tuples of constants can be precomputed by Python's peephole optimizer or AST-optimizer. Lists, on the other hand, get built-up from scratch:>>> from dis import dis
>>> dis(compile("(10, 'abc')", '', 'eval'))
1 0 LOAD_CONST 2 ((10, 'abc'))
3 RETURN_VALUE
>>> dis(compile("[10, 'abc']", '', 'eval'))
1 0 LOAD_CONST 0 (10)
3 LOAD_CONST 1 ('abc')
6 BUILD_LIST 2
9 RETURN_VALUE
#python #list #tuple #performance #dis #compile #ast_optimizer