node.js - MongoDB + node: not authorized to execute command (sometimes works, sometimes doesn't) -


i'm facing problem mongodb environment - setup follows:

my node app provides restify api handles user registration (look if user exists in collection based on mail, , if not, insert him (note - insert uses bcrypt hash passwords, bit slower)). uses restify , mongoose orm.

a second benchmark script (also written in node, running on same machine) accesses restify api using http put.

i'm starting around 20-30 of these requests in benchmark (with random data) , of api requests correctly insert new users. other, mongodb produces errors similar following:

not authorized on ... execute command { find: "users", filter: { mail: "rroouksl@hddngrau.de" } }

not authorized on ... execute command { insert: "users", documents: [ { ... } ], ordered: false, writeconcern: { w: 1 } }

some other users inserted fine. low number of requests @ same time (1-5) no problems occur. shouldn't mongo able handle these "low" amount of requests? problem because it's running on same machine? hasn't user created in mongo project got enough txns/second allowed?

best regards, zahlii

it turned out mongo still using "old" storage engine , not wiredtiger. since queries included updating records, old engine performed collection-based locks means errors solely based on read-write locks.

i migrated wiredtiger performs document-based locking , since then, database handles many parallel requests without these errors (although under heavy load appear again - part of mongo being nosql guess)


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -