New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sessions are so slow #47
Comments
I've barely looked through the code for Session (in web.d) and it seems to me at first glance the only thing negatively impacting performance is would be file IO. You could possibly get around that by using a database server of some sort, or even a faster harddisk or ssd... FYI; I haven't actually benchmarked this with php, but I'd be impressed if you got better performance from php there. whichever way I look at it, processing > 1000 requests per minute is fast. so taking 22 seconds to process 3000 (roughly 9000 per minute!) is nowhere near slow imho. |
On Tue, Aug 27, 2013 at 09:25:51PM -0700, Talha Zekeriya Durmuş wrote:
Probably be because creating a new session writes to a file. Did you test a PHP session where you saved a variable to it, not just creating it? But if PHP is fast when saving variables too, maybe they use something other Would you be ok with sessions going away when the app restarted? I could just I just pushed a new thing to web.d. Try compiling your thing with and see if it is any better. I got a 3x speedup using that on linux. Not sure how |
I have just tested this: void handler(Cgi cgi) { It processed 3000 request per second and that is almost near without file.write. So it is not about file writing thing. Slowness is relative with another thing. And for the test things I am using apache ab application with that parameters: c:\xampp\apache\bin>ab -c 10 -n 1000 http://127.0.0.1/ |
On Wed, Aug 28, 2013 at 11:32:53AM -0700, Talha Zekeriya Durmuş wrote:
It still could be files since the session doesn't just write one file. For every new request it creates a new file with a different name and I'd love a better way to do this, but haven't found one yet. Maybe something Your benchmark would only do one file with the simple code, which Windows |
And sorry I tested wrong server ip. Test results should not be taken notice of |
i realize this is really old and so is the code I'm about to describe, but I might as well document it somewhere. I created a better session system btw - compile with -version=webd_cookie_sessions. These will store all the session data in a signed client-side cookie. You'll also need hmac.d, the mhash C library (probably already installed on your system on Linux), and a file in the -J path called webd-cookie-signature-key.txt which should just be some long randomness. Since it is on the client, it will all be visible to them, but since it is signed (if I did that right), it shouldn't be easy for them to modify. It avoids files which is much faster than the old way. |
He is the some results with and without
Session session = new Session(cgi);
scope(exit) session.commit();
without:
Server Software: Microsoft-IIS/8.0
Server Hostname: 127.0.1.1
Server Port: 80
Document Path: /index.rhs
Document Length: 28 bytes
Concurrency Level: 20
Time taken for tests: 1.438 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 801000 bytes
HTML transferred: 84000 bytes
Requests per second: 2086.28 #/sec
Time per request: 9.586 ms
Time per request: 0.479 [ms](mean, across all concurrent requests)
Transfer rate: 543.98 [Kbytes/sec] received
with:
Document Path: /index.rhs
Document Length: 28 bytes
Concurrency Level: 20
Time taken for tests: 21.989 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 982195 bytes
HTML transferred: 84000 bytes
Requests per second: 136.43 #/sec
Time per request: 146.591 ms
Time per request: 7.330 [ms](mean, across all concurrent requests)
Transfer rate: 43.62 [Kbytes/sec] received
why session is so slow? I looked that in PHP. PHP is not slow . Maybe you could know I am trying to make a web programming language like PHP. And I need SESSIONS. What is the reason of low speed. Are you going to make it faster?
Thanks
The text was updated successfully, but these errors were encountered: