{"id":1896,"date":"2015-11-16T00:02:21","date_gmt":"2015-11-15T15:02:21","guid":{"rendered":"http:\/\/www.magtranetwork.com\/?p=1896"},"modified":"2017-05-17T09:29:59","modified_gmt":"2017-05-17T00:29:59","slug":"aws_lambda_python_disk_speed","status":"publish","type":"post","link":"https:\/\/www.magtranetwork.com\/aws\/aws_lambda_python_disk_speed.html","title":{"rendered":"AWS Lambda Python\u3067Lambda\u95a2\u6570\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u7c21\u6613\u6e2c\u5b9a\u3059\u308b"},"content":{"rendered":"

\u4ee5\u524d\u306e\u300cAWS Lambda Python\u3067Lambda\u95a2\u6570\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u901f\u5ea6\u30c6\u30b9\u30c8\u3092speedtest-cli\u3092\u7528\u3044\u3066\u884c\u3046<\/a>\u300d\u306e\u8a18\u4e8b\u3067AWS Lambda\u306e\u6027\u80fd\u6e2c\u5b9a\u306e\u4e00\u8cab\u3068\u3057\u3066\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u901f\u5ea6\u3092\u6e2c\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002<\/p>\n

\u4eca\u56de\u306fAWS Lambda\u306e\u6027\u80fd\u6e2c\u5b9a\u306e\u3046\u3061\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\u65b9\u6cd5\u3092\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

AWS Lambda Python\u3067Lambda\u95a2\u6570\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u7c21\u6613\u6e2c\u5b9a\u3059\u308b<\/h2>\n

Linux\u306e\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u6e2c\u5b9a\u3059\u308b\u306b\u306fUnixBench\u3001fio\u3001bonnie++\u306a\u3069\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u304c\u3001\u3053\u308c\u3089\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u30d3\u30eb\u30c9\u304c\u5fc5\u8981\u304c\u5fc5\u8981\u3060\u3063\u305f\u308a\u3001
\n\u6e2c\u5b9a\u306b\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n

\u305d\u306e\u305f\u3081\u3001yum\u3067\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305a\u3001\u307e\u305f\u5b9f\u884c\u6642\u9593\u30825\u5206\u307e\u3067\u3068\u6307\u5b9a\u3055\u308c\u3066\u3044\u308bAWS Lambda\u3067\u6e2c\u5b9a\u3059\u308b\u306b\u306f\u3069\u3046\u3057\u3066\u3082\u9650\u3089\u308c\u305f\u4f7f\u7528\u3067\u304d\u308b\u30b3\u30de\u30f3\u30c9\u3067\u306e\u7c21\u6613\u6e2c\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

\u3071\u3063\u3068\u601d\u3044\u3064\u304f\u3068\u3053\u308d\u3067\u306f\u66f8\u304d\u8fbc\u307f\u901f\u5ea6\u3060\u3051\u3067\u3059\u304c\u3001\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306bdd\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3057\u3066\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u6e2c\u5b9a\u3059\u308b\u3053\u3068\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n

AWS Lambda Python\u3067Lambda\u95a2\u6570\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u7c21\u6613\u6e2c\u5b9a\u3059\u308b\u30b3\u30fc\u30c9<\/h3>\n

Lambda\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30c7\u30a3\u30b9\u30af\u30a2\u30af\u30bb\u30b9\u901f\u5ea6\u3092\u6e2c\u5b9a\u3059\u308b\u969b\u306b\u6ce8\u610f\u3059\u308b\u3079\u304d\u70b9\u306fLambda\u5b9f\u884c\u30b5\u30fc\u30d0\u306b\u66f8\u304d\u8fbc\u3081\u308b\u5bb9\u91cf\u304c500MB\u7a0b\u5ea6\u3057\u304b\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002
\n\u305d\u306e\u305f\u3081\u3001\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30c6\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u5bb9\u91cf\u3092512MB\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u307e\u305f\u3001dd\u30b3\u30de\u30f3\u30c9\u306f\u300coflag=direct\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u66f8\u304d\u8fbc\u307f\u6642\u3001\u300ciflag=direct\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8aad\u307f\u8fbc\u307f\u6642\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f7f\u7528\u3057\u306a\u3044\u6307\u5b9a\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
\n\u305d\u306e\u305f\u3081\u3001\u300c\u30ad\u30e3\u30c3\u30b7\u30e5\u7121\u3057\u306e\u66f8\u304d\u8fbc\u307f\u300d\u3001\u300c\u30ad\u30e3\u30c3\u30b7\u30e5\u7121\u3057\u306e\u8aad\u307f\u8fbc\u307f\u300d\u3001\u300c\u30ad\u30e3\u30c3\u30b7\u30e5\u6709\u308a\u306e\u66f8\u304d\u8fbc\u307f\u300d\u3001\u300c\u30ad\u30e3\u30c3\u30b7\u30e5\u6709\u308a\u306e\u8aad\u307f\u8fbc\u307f\u300d\u306e4\u30d1\u30bf\u30fc\u30f3\u3092\u8a08\u6e2c\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\r\nimport commands\r\nimport os\r\n\r\nprint('Loading function')\r\n\r\ndef _(cmd):\r\n    return commands.getoutput(cmd)\r\n\r\ndef lambda_handler(event, context):\r\n    print("Disk Writing Speed (No Cache)")\r\n    print(_("time dd bs=1M count=512 if=\/dev\/zero of=\/tmp\/disktest oflag=direct"))\r\n\r\n    print("Disk Reading Speed (No Cache)")\r\n    print(_("time dd bs=1M count=512 if=\/tmp\/disktest of=\/dev\/null iflag=direct"))\r\n\r\n    print(_("rm -f \/tmp\/disktest"))\r\n\r\n    print("Disk Writing Speed (Cached)")\r\n    print(_("time dd bs=1M count=512 if=\/dev\/zero of=\/tmp\/disktest"))\r\n\r\n    print("Disk Reading Speed (Cached)")\r\n    print(_("time dd bs=1M count=512 if=\/tmp\/disktest of=\/dev\/null"))\r\n\r\n    print(_("rm -f \/tmp\/disktest"))\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u4ee5\u524d\u306e\u300cAWS Lambda Python\u3067Lambda\u95a2\u6570\u5b9f\u884c\u30b5\u30fc\u30d0\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u901f\u5ea6\u30c6\u30b9\u30c8\u3092speedtest-cli\u3092\u7528\u3044\u3066\u884c\u3046\u300d\u306e\u8a18\u4e8b\u3067AWS Lambda\u306e\u6027\u80fd\u6e2c\u5b9a\u306e\u4e00\u8cab\u3068\u3057\u3066\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u901f\u5ea6\u3092\u6e2c\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u8a18 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3,31,79,80],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1896"}],"collection":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/comments?post=1896"}],"version-history":[{"count":4,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1896\/revisions"}],"predecessor-version":[{"id":5633,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1896\/revisions\/5633"}],"wp:attachment":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/media?parent=1896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/categories?post=1896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/tags?post=1896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}