【问题标题】:AWS Cognito: Why does authenticateUser() take 14 seconds to complete?AWS Cognito:为什么 authenticateUser() 需要 14 秒才能完成?
【发布时间】:2016-12-11 03:07:39
【问题描述】:

当我使用与 aws-sdk-2.4.12 版本关联的所有 AWS Cognito 位登录到我的应用程序时,我发现 authenticateUser() 函数大约需要 14 秒才能完成。 (这种缓慢的响应行为并不新鲜 - 以前的版本也很慢。)

使用 Fiddler2,在隧道发送到 'cognito-idp.us-west-2.amazonaws.com:443 之前似乎用完 6 秒,然后 8 秒后调用成功完成。

问题是:为什么这么慢,有什么办法可以加快速度吗?
这是我的代码:

// Login
self.loginUser = function (username, password) {
    var authData = {
        Username: username,
        Password: password
    };

    var authDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authData);

    var userData = {
        Username: username,
        Pool: self.userPool
    };

    cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);

    cognitoUser.authenticateUser(authDetails, {
        onSuccess: function (result) {
            console.log('loginUser: ' + username);
        },
        onFailure: function (err) {
            console.log(err);
            console.log('FAIL loginUser: ' + username);
        }
    });
}

【问题讨论】:

  • 同理,所有源代码都在 AWS Lambda 函数中

标签: javascript amazon-web-services amazon-cognito


【解决方案1】:

我的错。这是没有问题的。这是在 Visual Studio 2015 中调试我的代码的神器。

这里是每个浏览器的登录时间结果,在桌面上运行,Win7x64。

登录时间:

  • Firefox:1.5 秒
  • 铬:2 秒
  • IE 11:3 秒
  • 使用 VS2015 调试 IE 11:14 秒

这是我第一次注意到 VS2015 显着影响 javascript 性能。任何人有一个理论为什么?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-14
    • 1970-01-01
    • 2017-02-24
    相关资源
    最近更新 更多