コード例 #1
0
        public async Task <ActionResult <string> > PostOrder(OrderCreateModel order)
        {
            Stopwatch timer = new Stopwatch();

            timer.Start();

            await _logger.LogAsync();

            await PostToDatabaseAsync(order);

            await _mailer.MailAsync();

            timer.Stop();

            return($"Response time: {timer.ElapsedMilliseconds}");
        }
コード例 #2
0
        public async Task <ActionResult <string> > PostOrder(Order order)
        {
            Stopwatch timer = new Stopwatch();

            timer.Start();

            //TODO PARALLEL 1: execute the following actions in parallel. Compare response time with the original response time
            //TODO CONCURRENCY 1: execute the following actions concurrently. Compare response time with the previous results
            //TODO PARALLEL 2: execute the following actions in parallel using a fire and forget strategy. Compare response time with the previous parallel response time
            //TODO CONCURRENCY 2: execute the following actions concurrently using a fire and forget strategy. Compare response time with the previous concurrent response time
            //TODO PARALLEL 3: execute the following actions in parallel using a queueing strategy. Compare response time with the previous parallel response time
            //TODO CONCURRENCY 3: execute the following actions concurrently using a queueing strategy. Compare response time with the previous concurrent response time
            await _logger.LogAsync();

            await PostToDatabaseAsync(order);

            await _mailer.MailAsync();

            timer.Stop();

            return($"Response time: {timer.ElapsedMilliseconds}");
        }