1.9.0

Load test results

Note that the results largely depend on the environment and the implementation. Even though the results are not directly comparable, they can still be used to get a rough idea of the performance. To see if the performance is sufficient for your use case, you should always do your own tests.

The tests where executed with the LoadTestExample, Unity Main Thread synchronisation and on a 8-core CPU (16 vCPUs) with a nVidia 2060. When Unity Main Thread synchronisation is needed, the amount of frames are important. Therefore the default VSync has been disabled for the test. The test was run on two machines, one acting as client and another acting as server. The client used 1.000 threads over five minutes to access the server.

With Unity Main Thread synchronisation (the last value has JMeter tear down overhead included):

Average response time

Without Unity Main Thread synchronisation (the last value has JMeter tear down overhead included):

Average response time

1.6.0

Migration to Response Builder

Starting with 1.6.0 the old SendAsync methods are marked deprecated. Unity will warn if the project uses the old methods. If the project needs to postpone the migration and silence the warnings, the define DISABLE_OBSOLETE_WARNING_OLD_RESPONSE_METHODS can be added to “Player Settings -> Platform -> Other Settings -> Scripting Define Symbols”.

Each obsolete warning lists how to convert the calls, additionally the table below lists the transformation:

OldNew
SendAsyncGetResponserequest.CreateResponse().Body(content).SendAsync()
SendAsyncErrorResponserequest.CreateResponse().StatusError().Body(content, contentType).SendAsync()
SendAsyncGetJsonResponserequest.CreateResponse().BodyJson(obj, contentType).SendAsync()
SendAsyncGetResponserequest.CreateResponse().Status(status).Body(content).Headers(headers).SendAsync()
SendAsyncGetResponserequest.CreateResponse().Status(status).Body(content).Headers(headers).SendAsync()
SendAsyncOkResponserequest.CreateResponse().SendAsync()
SendAsyncHeadResponserequest.CreateResponse().SendAsync()
SendAsyncOptionsResponserequest.CreateResponse().Header(HttpHeader.ALLOW, \“HEAD,GET,POST,PUT,DELETE,OPTIONS,TRACE\”).SendAsync()
SendAsyncTraceResponserequest.CreateResponse().Body(content, MimeType.MESSAGE_HTTP).SendAsync()
SendAsyncTraceResponserequest.CreateResponse().Body(content, MimeType.MESSAGE_HTTP).SendAsync()
SendAsyncDefaultInternalServerErrorrequest.CreateResponse().InternalServerError().SendAsync()
SendAsyncDefaultNotFoundrequest.CreateResponse().NotFound().SendAsync()
SendAsyncDefaultNotAuthenticatedrequest.CreateResponse().NotAuthenticated().SendAsync()

1.2.0

Test Coverage (1.2.0)

NameCoverage (%)Covered LinesCoverable Lines
RestServer.DefaultRequestHandlerImpl  68.4 %1319
RestServer.Endpoint100.0 %33
RestServer.EndpointCollection100.0 %8383
RestServer.Helper.HeaderBuilder100.0 %2626
RestServer.Helper.UnityNetHelper100.0 %66
RestServer.LowLevelHttpServer76.9 %1013
RestServer.LowLevelHttpSession77.7 %2836
RestServer.RestRequest88.4 %6978
RestServer.RestServer88.8 %4854
RestServer.SpecialHandlers100.0 %66
RestServer.ThreadingHelper100.0 %4949

Average: 90.9%

The missing methods to 100% are usually rare error handling code, like socket errors or other low level functionality.

Profile Marker (1.2.0)

Profile markers can be assigned when scheduling a workload via ThreadingHelper.Instance.ExecuteXXX methods like this

ThreadingHelper.Instance.ExecuteAsync(() => { 
	transform.position += new Vector3(0.001f, 0.001f, 0.001f); 
}, "Position Updates");

These can now be found inside the profiler

Screenshot of the profiler showing the waterfall graph

By default, the name of the execute method (e.g. ExecuteSync) is used as the profile marker name.