HTTPS server based on mbedtls runs very slow on ARM Cortex M4

Update May 29, 2019: I noticed this function ssl_prepare_server_key_exchange() in ssl_srv.c consumes about 15 seconds, most of which is spent on mbedtls_pk_sign(). Is this a normal time spend on an Arm cortex M4?

Hi, we had an embedded HTTP server running on FreeRTOS+LWIP on ARM Cortext M4 ( NXP LPC433x). Recently we rewrote the HTTP server with MbedTLS and made it an HTTPS server. However, we noticed the new HTTPS server is very slow, and some web pages are barely loadable in Chrome/Firefox . But if the the web page is a very simple HTML, it is fine. The HTTP server without TLS is running OK for all the web pages we are hosting on this embedded system.

We haven’t profile the HTTPS server to see where the bottleneck, but would like to know what might be the cause of this slow performance, and what config can be tuned to improve it. Thanks!