zeromq adventures and linkfinder

I have been hearing about ZeroMQ for a bit now, but had never really dug in until 72 hours ago. I must say, I am impressed. Maybe I am easily amused (likely), or maybe I have just been having a good run with technology lately, but nevertheless, I will share a bit of my experience.

What is ZeroMQ (aka '0mq') you ask? At first glance it comes across as a networking library, but that is just the tip of the iceberg. Once cracked open it is a concurrency library, networking library, and socket library all wrapped into one really simple and concise api.

Sounds like it is chalk full of features and bloatware, but right on the front of their site they have 'Less is more' in big bold letters. I like this concept in engineering most of the time. Actually I like this concept applied to life itself most of the time. Unless I am at a vegas buffet anyways. Hah!

So I figured for a quick test trial of the library I would write a service in C that returns links in a given webpage. One or more clients will connect to the service and send a url that it would like scanned. This url is then downloaded, parsed, and the links in it, if any, are returned in JSON format.

Without further ado, check it out on github: https://github.com/cowboyrushforth/linkfinder. Turned out to be about 245 sloc and only took a few spare hours to write. How it is setup is that the main thread has one big event loop that 0mq runs and accepts requests. These requests go into a queue that one of 4 worker threads pick up. The worker picks up a request, does all the downloading, parsing, and then sends the request back to the mainthread which then delivers it to the client. It could use a bit of additional error handling thought, but is incredibly simple.

If your feeling like a technologically inspirational read, check out the ZeroMQ guide. It is very comprehensive and really shows the full potential of the library.

Cheers!

 


Comments:

Houses are expensive and not every person is able to buy it. However, <a href="http://bestfinance-blog.com">loan</a> was invented to support people in such situations.
Posted By: Lorena28Aguilar, 5 months ago

Add Comment:

Your Name:
Your E-Mail:
(Not Displayed)
Comment:
Security Code:99c515cd1f42187dae0bb5970642283e0959955e
Type Security Code:


Back

Tag cloud

  1. 1 entries are tagged with 2007
  2. 1 entries are tagged with 2008
  3. 1 entries are tagged with 2009
  4. 2 entries are tagged with 2010
  5. 1 entries are tagged with altly
  6. 2 entries are tagged with applevalley
  7. 1 entries are tagged with archlinux
  8. 1 entries are tagged with artichoke
  9. 1 entries are tagged with automation
  10. 1 entries are tagged with batcountry
  11. 1 entries are tagged with beats
  12. 1 entries are tagged with bigsur
  13. 3 entries are tagged with bm2009
  14. 1 entries are tagged with bm2010
  15. 8 entries are tagged with burningman
  16. 2 entries are tagged with c
  17. 1 entries are tagged with christmas
  18. 8 entries are tagged with code
  19. 1 entries are tagged with consistent
  20. 1 entries are tagged with cplusplus
  21. 1 entries are tagged with desert
  22. 1 entries are tagged with drinks
  23. 1 entries are tagged with dspam
  24. 2 entries are tagged with dunes
  25. 1 entries are tagged with energy
  26. 1 entries are tagged with esplanade
  27. 5 entries are tagged with europe
  28. 1 entries are tagged with evdo
  29. 2 entries are tagged with flv
  30. 1 entries are tagged with gadgets
  31. 1 entries are tagged with government
  32. 1 entries are tagged with haiku
  33. 1 entries are tagged with hashring
  34. 1 entries are tagged with icecast
  35. 1 entries are tagged with internetradio
  36. 1 entries are tagged with iphone
  37. 1 entries are tagged with linkfinder
  38. 2 entries are tagged with losangeles
  39. 1 entries are tagged with math
  40. 1 entries are tagged with minespotter
  41. 1 entries are tagged with minesweeper
  42. 3 entries are tagged with mix
  43. 1 entries are tagged with motivation
  44. 1 entries are tagged with moving
  45. 3 entries are tagged with music
  46. 1 entries are tagged with newserver
  47. 4 entries are tagged with node.js
  48. 1 entries are tagged with obama
  49. 1 entries are tagged with oil
  50. 1 entries are tagged with productivity
  51. 1 entries are tagged with radio
  52. 1 entries are tagged with rails
  53. 3 entries are tagged with recipe
  54. 1 entries are tagged with redmine
  55. 2 entries are tagged with reflections
  56. 1 entries are tagged with rmine
  57. 8 entries are tagged with ruby
  58. 1 entries are tagged with salmon
  59. 1 entries are tagged with salsa
  60. 1 entries are tagged with shoutcast
  61. 3 entries are tagged with site
  62. 2 entries are tagged with snow
  63. 1 entries are tagged with spill
  64. 1 entries are tagged with spotmanradio
  65. 1 entries are tagged with streamtranscoder
  66. 1 entries are tagged with summer
  67. 1 entries are tagged with tecate
  68. 1 entries are tagged with technology
  69. 1 entries are tagged with thanksgiving
  70. 1 entries are tagged with thoughts
  71. 6 entries are tagged with travel
  72. 1 entries are tagged with trip
  73. 1 entries are tagged with turkey
  74. 3 entries are tagged with twitter
  75. 1 entries are tagged with website
  76. 1 entries are tagged with wordsquared
  77. 4 entries are tagged with work
  78. 1 entries are tagged with x4200
  79. 3 entries are tagged with yz250
  80. 1 entries are tagged with zeromq

Twitter Updates

Links to check out

Subscribe RSS