Code Monkey home page Code Monkey logo

Comments (6)

d2fn avatar d2fn commented on July 17, 2024

Ids generated by flake will always fit into 128-bits. They will never grow outside of this bounds. Using flake to generate URLs seems like a fine plan so long as you don't mind the shortened URLs being predictable by nature (base-62 encoded they will be 18-characters in length). If you want them to be unpredictable so that having one of these URLs acts as authorization to a private resource, you might want to explore other alternatives like base-62 encoding a secure cryptographic hash.

Does this help? Happy to answer any more questions.

D

from flake.

tarnfeld avatar tarnfeld commented on July 17, 2024

My only worry about this is, the purpose of these urls is to be short, they go into tweets... so i'm concerned since the IDs will only go into 128-bits the urls are going to be pretty long.

At the moment, with my mysql auto-inc counter the suffix is about 5 characters, and will stay there until 3,500,000 rows. Then it'll move to 6 characters until 36,200,000 rows. It's important to me to keep these urls short. I'm not sure if flake is the right thing for me :(

Could you perhaps recommend something else, or maybe I could modify flake to fit into what I want? I've been looking around for weeks and have found nothing...

Also, how can Flake handle failover situations, I presume I would have to classify the node running flake (and the web server) as failing if that flake instance died? Do you tend to run an instance of flake per application node?

from flake.

tarnfeld avatar tarnfeld commented on July 17, 2024

Any news on this? :-) Thanks.

from flake.

d2fn avatar d2fn commented on July 17, 2024

It sounds like flake ids might not be the best fit for what you are doing. Here's a thread on url shortening algorithms that might be a better fit.

Yes typically we run flake on every host that is in need of an id generation service so that they all talk over localhost--and there is no reason not to do this since no coordination between flake nodes is required. There is no notion of failover in flake itself.

from flake.

tarnfeld avatar tarnfeld commented on July 17, 2024

Do you have that link? :-) Thanks again for your help!

from flake.

d2fn avatar d2fn commented on July 17, 2024

No problem. Sorry about leaving off the link earlier. Here it is http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047

from flake.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.