Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <ArunC> Hello
  2. <alphaglosined> hi hi
  3. <ArunC> I'm not sure if this is the right place to ask about vibe.d, but not sure where else to go.
  4. <ArunC> I'm trying to develop an app in D that exposes RESTful services and at the backend, it would spawn and manage a bunch of processes (workhorses)
  5. <alphaglosined> expensive operation seperate processes but ok
  6. <ArunC> We are predominantly a C++/Java shop and I'm trying to inject D here, just because I think it is a much better alternative.
  7. <alphaglosined> indeed, so where is the problem?
  8. <ArunC> We have these "child" processes listening on ZMQ IPC sockets and working already. There is no problem with that. I am wondering if it is possible for us to expose vibe.d handlers to communicate via ZMQ with the backend processes.
  9. <ArunC> As I read, vibe.d works on fibers and not on explicit threading, whereas ZMQ works on explicit threading (created by zmq contexts)
  10. <alphaglosined> oh I see so you're worried that the fibers won't execute on the proper thread
  11. <alphaglosined> in that case I would use message passing if you don't need to get a response from the backend process
  12. <alphaglosined> with a dedicated thread handling it
  13. <ArunC> Fibers are executed using cooperative IIRC. So if we are to create a context, send and receive (let's assume a simple REQ-REP here) and close the context, I wondering if fibers would go by that.
  14. <ArunC> hmm, I see.
  15. <ArunC> The constraint here is, we can't change the backend processes.
  16. <ArunC> ...unfortunately
  17. <alphaglosined> yeah in your case the problem with fibers is you cannot guarantee the thread for a request handling
  18. <ArunC> I see.
  19. <ArunC> Is there anyway for us to instruct vibe.d to use a concurrency model described by the user? ie, to choose thraeds instead of fibers?
  20. <alphaglosined> no
  21. <alphaglosined> it would also make it significantly slower
  22. <ArunC> Well, there are use cases like this where it makes sense to do that, albeit being slow compared to fibers. But definitely much faster compared to the implementations in other languages (with the benefit of readability), which is why I'm here. :-)
  23. <alphaglosined> maybe vibe.d is the wrong solution then
  24. <ArunC> hmm, any other RESTful frameworks in D?
  25. <alphaglosined> I don't think you need the extra functionality
  26. <alphaglosined> maybe just a CGI interface will be enough
  27. <alphaglosined> https://github.com/adamdruppe/arsd/blob/master/cgi.d
  28. <alphaglosined> adam_d_ruppe
  29. <ArunC> I would definitely need a RESTful frontend with an implicit json support.. something like https://github.com/matt-42/silicon/
  30. <ArunC> Silicon (C++) - it is all macro magic + awful template syntax, a bit like using a language extension.. so I'm a bit hesitant to resort to that solution..
  31. <alphaglosined> because of D's CTFE capabilities, while you won't find any implicit json support
  32. <alphaglosined> but you can always implement it as you need
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement