How can I test concurrency code of backend instance in development environment ? Here is my backends.xml
<?xml version="1.0" encoding="UTF-8"?>
<backends>
<backend name="hitsSaver">
<class>B1</class>
<instances>4</instances>
<!-- max-concurrent-requests>20</max-concurrent-requests -->
<options>
<dynamic>true</dynamic>
</options>
</backend>
</backends>
In Development Console I see only one instance but “/_ah/start” was called 4 times. Are they all handled in the same thread ?
The dev_appserver will not spawn multiple backend instances. With multithreading, though, you can have multiple concurrent requests, which should be sufficient.
Testing with mocks and throwing that exception yourself would be a better idea. Bear in mind that if you’re using datastore transactions, the transaction wrapper will catch that exception and retry.