The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2015-02-16

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:03 Grinnz sri++ # i just thought of like 3 more things i might be able to do with this pubsub
00:08 sri https://31.media.tumblr.com/fd284f3641ab9e46d0b7a336636cbd18/tumblr_inline_mnshfy1TgY1qz4rgp.jpg
00:14 n2plato joined #mojo
01:11 Averna joined #mojo
01:11 good_news_everyon joined #mojo
01:11 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/NDRO
01:11 good_news_everyon mojo/master 581885e Sebastian Riedel: better description for finish event
01:11 good_news_everyon left #mojo
01:18 inokenty-w joined #mojo
01:24 jberger sri++
01:24 jberger Maybe a blog post? it's been a number of days since the last "Mojolicious hack of the day"
01:25 sri somehow i don't have the patience for blogging anymore :/
01:26 jberger I guess that's what us minions are for :-)
01:26 jberger just saw the Turing movie
01:26 * sri cracks the whip
01:26 jberger quite good though amazingly non technical
01:27 sri purl: jberger is also https://s-media-cache-ak0.pinimg.com/236x/7f/75/6b/7f756bcb3481db56650768cc5fc0cf50.jpg
01:27 purl okay, sri.
01:27 jberger hahaha
01:27 jberger ok that stays
01:47 good_news_everyon joined #mojo
01:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ND2b
01:47 good_news_everyon mojo/master d9ea48e Sebastian Riedel: fix url_for to handle paths without trailing slash correctly in embedded applications
01:47 good_news_everyon left #mojo
02:02 kaare joined #mojo
02:04 marty joined #mojo
02:13 marty joined #mojo
02:29 bwf joined #mojo
02:51 klapperl_ joined #mojo
02:52 Dandre joined #mojo
03:05 noganex joined #mojo
03:06 good_news_everyon joined #mojo
03:06 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ND93
03:06 good_news_everyon mojo/master 2013377 Sebastian Riedel: use link_to helper in generated app
03:06 good_news_everyon left #mojo
03:49 marty joined #mojo
03:58 davido_ltp joined #mojo
04:09 dotandimet joined #mojo
04:26 asarch joined #mojo
04:28 Vertig0 joined #mojo
04:35 Oleg joined #mojo
04:41 hshong joined #mojo
06:17 basiliscos joined #mojo
07:05 Vertig0 left #mojo
07:14 marmez joined #mojo
07:18 reneeb joined #mojo
07:31 cpan_mojo Mojo-HelloMojo 0.01 by Stefan Adams - http://metacpan.org/release/SADAMS/Mojo-HelloMojo-0.01
07:38 sujithm joined #mojo
07:49 McA joined #mojo
07:49 reneeb joined #mojo
07:55 dod1 joined #mojo
07:56 dod1 joined #mojo
07:58 McA joined #mojo
07:59 dod1 joined #mojo
08:03 eseyman joined #mojo
08:09 Vandal joined #mojo
08:26 trone joined #mojo
08:44 linagee joined #mojo
08:56 odc joined #mojo
08:57 fhelmber_ joined #mojo
09:34 jontaylor joined #mojo
09:54 Shaeto joined #mojo
10:11 vytas joined #mojo
10:34 Dandre joined #mojo
10:55 Dandre joined #mojo
10:59 jontaylor joined #mojo
11:01 csson joined #mojo
11:22 jwang joined #mojo
11:27 zivester joined #mojo
11:45 jwang joined #mojo
12:42 lucs left #mojo
13:19 jberger any idea what ^^ is?
13:23 mishantil jberger: As in the emoticon?
13:24 mishantil Basically "i'm giddy / happy".
13:28 hernan604 or read above ^^
13:37 jberger mishantil: no, I was asking about Mojo::HelloMojo
13:38 jberger like hernan604 said
13:40 mishantil Ah. I just saw a quit/join-flood above, so I discarede 'read above' as an option.
13:41 mishantil Still have not gotten around to hiding quit/join-messages.
14:05 arthas joined #mojo
14:08 eseyman joined #mojo
14:27 marmez left #mojo
14:39 zivester joined #mojo
14:40 marty joined #mojo
14:57 gryphon joined #mojo
15:00 batman jberger: looks like toadfarm, just not as good ;)
15:01 jberger I'm finally to the point where toadfarm might be useful, I should read about it again
15:01 batman jberger: cool! let me know when you have any feedback
15:02 batman jberger: it even has decent documentation now (imo)
15:02 batman let me know if it hasn't, hehe
15:02 jberger might still be a little bit, we are deploying our first mojo app soon with a second one in the works
15:02 batman ok
15:02 jberger for now its nginx, but toadfarm sounds like fun
15:03 batman i use toadfarm behind nginx
15:03 jberger hmmmmmmm
15:03 batman allow me to only configure one upstream in nginx and then do the routing in toadfarm
15:03 batman https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/BehindReverseProxy.pod
15:09 mishantil batman: Toadfarm assumes that all the apps it embeds use the same version of perl and the same version of libs right?
15:09 batman mishantil: yes. after all: it's perl.
15:10 batman or to use different words: it's a limitation in perl. not in toadfarm.
15:10 mishantil batman: Unless you did some crazy forking w/ set environments for the various apps, and added som IPC-magic?
15:11 tomboh if you want applications to use different versions of perl and CPAN modules, there's not much point running those applications within the same process
15:11 batman mishantil: but that would be super slow. you might as well use my Mojolicious::Plugin::CGI module if you want that :P
15:11 mishantil But yeah, I understand the design that has been picked for toadfarm. Makes sense for certain situations.
15:12 batman mishantil: it would be overkill to make toadfarm work in that situation. i can't see any benefit in having toadfarm doing any work if that was the case.
15:13 batman i would rather just use nginx and have many perl apps.
15:13 batman mishantil: i first designed toadfarm to use less memory when deploying to environments such as digitalocean.
15:13 mishantil batman: That's what we do (except we don't use nginx). We need to run apps in separate env's with locked lib-/perl-versions.
15:13 batman oops! "to solve the memory issue"
15:14 batman since perl use x MB memory just by loading the app+libraries, i wanted to be able to load 10 apps without hitting the memory limit.
15:14 batman mishantil: what do you use?
15:15 mishantil batman: [pound] -> [varnish] -> [hypnotoad]
15:15 batman i didn't have nginx in front, since nginx would also use memory, so i simply used the "Host" header to route it to the different apps in toadfarm
15:15 batman mishantil: ok
15:17 mishantil batman: Memory is less of an issue for us, but being sure _nothing_ changes in one app because of changes in another (dependencies) is paramount.
15:17 batman mishantil: yeah. memory is almost never an issue if you have your own server :)
15:18 mishantil batman: Currently we're buying VPS'es, but will in a short time move to having our own servers. But that's just a data-governance issue. Not cost-driven.
15:19 batman :)
15:21 mishantil Actually, our costs increase by almost an order of magnitude just because of the laws here in Norway. Annoying to say the least.
15:21 basiliscos joined #mojo
15:32 sujithm joined #mojo
15:36 jberger mishantil: you could come to the US and have your data mined by the government without any real oversight
15:37 mishantil jberger: Same thing is happening here. :) But as private contractors we get screwed if we don't follow certain parts of the legislation.
15:38 jberger I don't think contract status has anything to do with it tbh
15:40 mishantil Well, for us it is like this; we need to _guarantee_ that we follow the legislation and protect personal data on individuals. If we don't then we basically have no business.
15:41 mishantil The authorities have to stick to the same legislative framework, but if they breach it then there is no consequence.
15:41 mishantil Whereas for us it would be game over.
15:44 * sri wonders if the thundering herd problem is even a problem anymore for hypnotoad
15:44 sri so far removing the accept mutex has only resulted in better performance in my tests
15:45 jberger purl: does that sound right?
15:45 purl jberger: i haven't a clue
15:46 jberger what else would be "fixing" the problem?
15:46 sri there is only accept mutexes as far as i know
15:50 sri thing is, i don't think hypnotoad can ever be fast enough to truly benefit from an accept mutex
15:51 sri we all know the problem, connection comes in, all workers wake up and try to accept, only one gets it and some resources have been wasted
15:51 sri now, thing is, we also waste quite a few resources with the solution
15:52 sri ironically the solution wastes resources under load, while the problem wastes resources when mostly idle
15:53 sri (load = idle websocket connections, idle = just one connection)
15:54 sri you can test the difference with this patch https://gist.github.com/anonymous/fa658c590000dcda92b6
15:57 sri i'm literally unable to find a scenario where performance is worse after the patch
15:57 amon joined #mojo
15:57 sri and i've gone as far as using 20 workers on a 2 core box
15:59 jberger and it seems to simplify the coe
15:59 jberger code
15:59 jberger thats a tough case to beat
16:01 batman i got Mojo::IOLoop->timer(3 => sub { $c and $c->render(json => {}); }); in my code -- is there any logic that can cause $c to go out of scope..?
16:01 sh4 joined #mojo
16:01 batman i mean, is the "$c and..." part required?
16:02 batman i can't seem to reproduce it in my testing, but $c seem to go out of scope in production where the load is a lot higher.
16:06 jberger $c shouldn't go out of scope there
16:06 jberger but you might want to keep a strong reference to the tx
16:06 jberger $tx and $c->render ...
16:07 batman but can $tx go out of scope, if $c is still in scope..?
16:07 jberger (I would normally write it as $c->render(...) if $tx, but that is up to you :-))
16:07 jberger batman: http://mojolicio.us/perldoc/Mojolicious/Controller#tx
16:08 jberger wanna see something kinda cool: https://gist.github.com/jberger/30cea1402282dc777275
16:14 basiliscos joined #mojo
16:14 sujithm joined #mojo
16:21 asarch joined #mojo
16:22 sri jberger: it's also pretty much all untested code
16:22 sri i think a lot speaks for at least giving it a try
16:23 asarch In Dancer they call them \'Before hooks\' and in other languages, \'Decorators\'. What is their name in Mojolicious and where can I learn more about them?
16:23 jberger sri: what is the worst-case scenario? performance degradation on low volume requests?
16:23 asarch (A special controller that is called before any other)
16:23 sri jberger: yea, that's about it
16:24 jberger then I'm ok with giving it a try I suppose
16:24 jberger asarch: what have you tried?
16:24 asarch Is it: under sub { ... }?
16:24 jberger that is probably how I would do it, depending
16:25 asarch I'm learning about sessions
16:25 Insane joined #mojo
16:25 sri there is under and hooks
16:26 asarch So far, I've been reading Mojolicious::Growing (this is my starting point)
16:26 sri if you can use under, use under
16:26 jberger asarch: did you read Mojolicious::Guides::Tutorial? (that is actually the starting point)
16:26 jberger growing is the second chapter
16:27 asarch Actually, I am reading it (I am at Route names)
16:27 sri jberger: oh i forgot, there is another way to deal with the thundering herd problem, it's not an option for us though... you can have the manager process accept all connections and pass the file descriptors to the workers through pipes
16:28 jberger asarch: with absolutely no intention of sounding rude, hopefully after you read through the guides you won't need to ask these questions :-)
16:29 jberger if so, then we might adjust the guides
16:29 reneeb joined #mojo
16:30 asarch Don't worry jberger about been rude, that's ok for me. At least I know where to start
16:30 asarch Thank you guys
16:30 asarch Thank you very much :-)
16:51 sujithm_ joined #mojo
16:54 teejay joined #mojo
16:55 teejay hypnotoad doesn't take a -I option like plack, perl, etc does it?
16:56 batman teejay: no.
16:56 batman teejay: there wouldn't be any way to communicate that when doing hot reloading (isn't an easy way)
16:58 teejay plack does it>
16:58 teejay nevermind, munged perl5lib instead
17:00 batman teejay: no it doesn't. it can't hot reload
17:00 batman it = plack
17:01 teejay "hot reload" being different to plackup -R?
17:02 batman yes. very different.
17:02 batman there's nothing hot about -R. it's just "reloading" :)
17:02 Ptolemarch joined #mojo
17:02 teejay right
17:03 batman s/hot reloading/hot deployment/
17:03 batman see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#DESCRIPTION
17:03 batman it means that hypnotoad can "restart" without loosing any ongoing connections
17:03 teejay neat
17:03 batman indeed.
17:16 Anon021 joined #mojo
17:28 csson joined #mojo
17:35 melo joined #mojo
17:37 Oleg joined #mojo
18:37 davido_ltp joined #mojo
18:45 batman sri: is $tx's finish event supposed to be emitted twice on $stream "close" ?
18:45 sri no
18:46 sri there are no safety measures though
18:46 sri i proposed an emit_once() method a few weeks ago, but it got no support
18:46 batman ok. should i make a failing test?
18:46 sri not sure i want to fix it
18:46 sri as of now it's undefined behavior
18:48 batman ok. i'm using $tx->on(finish => sub {}) to write make an accesslog and it will log twice. i thought i could do $tx->once(), but i actually want the last event, and not the first, hehe
18:48 sri maybe try tracking it down yourself, who knows, maybe there's a real bug
18:49 odin22 joined #mojo
18:49 batman ok. so instead of making a failing test, i should simply point at the lines that emit the event?
18:50 sri sorry, but i'm not going to help you with that
18:50 * batman is confused...
18:50 batman give me a sec sri, and i'll make a paste :)
18:50 sri i wanted to talk about the problem a few weeks ago, then nobody cared, now i don't care ;p
18:51 batman damn you real life!!!
18:51 batman hehe
18:55 sri instead i'm ripping out the accept mutex today
18:55 Ptolemarch joined #mojo
18:58 batman sri: if you're curious: https://gist.github.com/jhthorsen/7be466443951aabe256f
19:01 * batman have to go soon...
19:03 sri looks like i get to completely rewire Mojo::IOLoop internals
19:03 sri maybe i can even get rid of all the recurring timers
19:04 * batman skips
19:04 sri so far just the graceful shutdown stuff turned out to be a little complicated
19:07 dotandimet joined #mojo
19:19 bobkare joined #mojo
19:22 * sri thinks about replacing Mojo::IOLoop::max_connections with Mojo::IOLoop::concurrency
19:22 sri and turn it into a method
19:22 sri that eliminates the last recurring timer
19:24 sri it was always a bit special, since it was an attribute that could start a graceful shutdown
19:25 sri Mojo::IOLoop->concurrency(0) looks better for that
19:30 sri cpu usage is suuuuuper smooth for huge numbers of websocket connections :)
19:32 jberger sri++
19:34 basiliscos joined #mojo
19:41 Insane joined #mojo
19:57 dotandimet joined #mojo
20:04 punter joined #mojo
20:04 alnewkirk joined #mojo
20:10 vytas` joined #mojo
20:16 sri test coverage up to 92.1%
20:19 batman sweet! :)
20:19 dotandimet1 joined #mojo
20:37 batman nginx is curious... i don't think it receives a response from mojolicious (at least Data::Dumper::Dumper($tx) doesn't say there's much in $tx->res), but still it logs the request as "200 OK"
20:43 * sri is fighting with global destruction stuff again...
20:44 kaare joined #mojo
20:56 * batman gets finish, finish, resume, finish $tx events :(
21:01 vytas` joined #mojo
21:08 sri i'm sick and tired of this stuff... so i'll introduce a new idiom :)
21:08 sri return if defined(${^GLOBAL_PHASE}) && ${^GLOBAL_PHASE} eq 'DESTRUCT';
21:08 mst that's new to you?
21:09 sri new to the codebase
21:09 mst return if in_global_destruction(); is everywhere in my legacy code
21:09 mst and Moose/Moo pass a flag to DEMOLISH
21:09 mst so it's 'return if $_[1];'
21:24 good_news_everyon joined #mojo
21:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/N5Ot
21:24 good_news_everyon mojo/master 15ba0ad Sebastian Riedel: reduce idle CPU usage by not using an accept mutex
21:24 good_news_everyon left #mojo
21:24 sri pretty big commit
21:26 sri please test it
21:26 mst sri: note that you may want to poke at the internals of Devel::GlobalDestruction for ways to make that slightly more robust on older perls
21:27 mst I suspect you won't actually want to steal the code
21:27 mst but it's worth knowing what you aren't stealing :)
21:27 sri i'm ok with versions before 5.14 getting warnings
21:27 mst fair
21:28 sri we also don't take care of the $@ bug anymore with eval
21:28 mst people who're irrationally scared of upgrading probably aren't going to be mojo users in the first place
21:28 sri the rule is we keep tests kinda passing, that's it
21:30 sri jberger, batman, marcus, tempire: ^
21:31 sri we now use ${^GLOBAL_PHASE} to handle global destruction stuff, i'm sure there will be false bug reports
21:31 sri those warnings on 5.10 and 5.12 are intentional
21:32 sri lets call it a strategy to get folks to use a modern perl :)
21:32 jberger wow, I don't have time to review that until after $work
21:33 sri scary how much of the accept mutex code was totally untested
21:33 sri much easier to follow the ioloop internals now
21:34 sri and i bet there's more optimization potential
21:35 jberger I'll be interested to look at that
21:35 sri and make sure to try the chat.pl example with preforking
21:36 sri suuuuper smooth
21:36 sri even the poll reactor is humming along now at 0.0% cpu usage
21:37 nicomen \o/
21:38 sri i wonder if modern kernels actually protect from the thundering herd problem even when you put the listen socket into a select()/poll()
21:47 sri batman: maybe reated to your problem, these just randomly failed for me https://github.com/kraih/mojo/blob/master/t/mojolicious/longpolling_lite_app.t#L286-L287
21:47 marmez joined #mojo
21:47 sri i rember seeing that a few days ago too
21:48 sri *+em
21:48 bpmedley_ joined #mojo
22:35 sri hmm, i suppose Mojo::IOLoop->concurrency could also be split into ->max_connections and ->stop_gracefully
22:40 batman sri: I will look at it tomorrow morning!
22:42 batman Hope I understand anything mutex-related...
22:42 good_news_everyon joined #mojo
22:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/N511
22:42 good_news_everyon mojo/master a8623de Sebastian Riedel: acceptors are not important anymore
22:42 good_news_everyon left #mojo
22:42 sri batman: you don't really have to, just check if any of your evented apps goes haywire
22:50 reno joined #mojo
22:51 reno hi
22:59 sri this would be the variant with ->max_connections and ->stop_gracefully instead of ->concurrency https://gist.github.com/anonymous/469dce107a3b3d7fb1ec
22:59 marty joined #mojo
23:01 Grinnz i like that... makes it more of a command than a setting
23:01 reno sri : mojolicious is nice toy ! ;-)   gg
23:13 disco_ joined #mojo
23:15 disco joined #mojo
23:18 good_news_everyon joined #mojo
23:18 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/N5bd
23:18 good_news_everyon mojo/master f20bb22 Sebastian Riedel: add stop_gracefully method to Mojo::IOLoop
23:18 good_news_everyon left #mojo
23:32 good_news_everyon joined #mojo
23:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/N5ht
23:32 good_news_everyon mojo/master 158d4ef Sebastian Riedel: use @_ only for one-liners
23:32 good_news_everyon left #mojo
23:45 Averna joined #mojo
23:46 jberger my first comment on the patch is that by removing some options and changing -a aren't you introducing breakage?
23:46 sri how odd, it looks like i broke SIGINT/SIGTERM somehow
23:46 sri jberger: untested
23:47 jberger public api is kinda a feature though isn't it?
23:47 sri not if it's untested imo
23:47 jberger how does a user know that?
23:47 jberger run the coverage?
23:47 jberger I like this direction, I REALLY do
23:48 jberger I say we make it 6.0
23:48 jberger soon if we want
23:48 * sri disagrees, only stuff with documentation *and* tests is a feature
23:48 sri that's the rules
23:49 sri if you don't like it find ways to test this stuff
23:49 jberger argh, but people's app's that use accessors for those are going to break
23:49 jberger I want to remove them, but I also don't want apps to die either
23:49 jberger which is why I say, lets do this at 6.0 which can be soon
23:50 sri if you want to change the rules, please make a proposal
23:50 sri i want to get this stuff tested now
23:51 jberger how was a common user supposed to know that those public api attributes were not tested features?
23:54 sri hahahaha, i did not break SIGINT/SIGTERM, the reactor is just in a very long poll()
23:55 sri this is a funny problem
23:56 Grinnz perhaps untested features should be noted as such in the docs

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary