I am a beginner to the process of URL generation and its money aspect, but recently while chatting on a chatroom for a SO question, I realized that there was an option to generate and have a permalink for every comment made there. That made me wonder that since one can potentially chat indefinitely, we can potentially generate a huge amount of links.

A typical link is of the form - http://chat.stackoverflow.com/transcript/message/36301354#36301354.

So it is not like its a single link for the whole chat, and hashes are used for all the components of the chat (comments in this example). As you can see the number before and after the # are the same, meaning there will be a new link for each comment. Also considering there can be a huge amount of sources of chat, combined with the fact that any chat can go indefinitely, I was wondering if it was cost-effective. I believe, a fee has to be paid for all your real estate on the internet - irrespective of the plan you buy. So wouldn't this lead to a lot of expenditure. Even if you pay upfront, isn't it too big of a feature (permalink for every comment)?

I don't think this question is more appropriate for Money Stackexchange because it's more about how these links are handled. It could suit better for something like Internet/Web StackExchange, but I am not sure if we have any such site

  • 2
    Everything costs money, but the cost of websites is a) domain registration; b) SSL certs; c) ISP connection/data; d) server maintenance and e) code upkeep. The cost of maintaining paths on a server once the server is paid for is so remarkably small it would be impossible to price it. Perhaps it costs SE a penny (total) for all the chat permalinks past the first; that would be about the max. – Nathan Tuggy Mar 29 '17 at 6:20
  • If done correctly you only have to store the 4 bytes making up that number. – rene Mar 29 '17 at 6:21
  • @rene, OK so storing the link is easy. But generating a new link on the web everytime should cost money, right? – user1993 Mar 29 '17 at 6:26
  • @NathanTuggy, so are you saying that once a domain is bought on a server, we can have an exorbitantly large number of URLs within it for almost no cost? – user1993 Mar 29 '17 at 6:48
  • On SE it is the primary key of the table, so if there are any costs involved those costs has to be made anyway. – rene Mar 29 '17 at 6:48
  • @rene, could you simplify your last comment? I could understand no part of it :( – user1993 Mar 29 '17 at 6:50
  • Look at this query where I used posts (questions) and their permalink. They simple come from a database table. That said, I have the feeling you need do some research into the subject and then narrow your question down to something that is answerable. At the moment it feels rather broad, also based on the comments now. – rene Mar 29 '17 at 6:59
  • 3
    There is no fee or anything similar for "generating" a link. No licenses have to be paid, the link does not have to be registered in some sort of global database, the mere act of generating a link isn't even noticeable by anyone who is not actively looking at your website that contains the link. You may be confusing links with domain names. – HugoRune Mar 29 '17 at 7:10
  • @rene yes, I see the link you provided and to me it seemed like a database of questions and their contents, which can be conveniently called because they are well documented in a database. But my question is that creating so many URLs in the first place should take up a lot of internet real estate and hence should cost money. sorry if I am too wrong – user1993 Mar 29 '17 at 7:11
  • Let's say you're wrong or at least, assuming taking up real estate is a real problem, it isn't caused by permalinks. – rene Mar 29 '17 at 7:18
  • @HugoRune and rene, thanks! – user1993 Mar 29 '17 at 7:21
  • 3
    @user1993: Yes. Once you register a domain name, it's your domain, in the sense that it's under your absolute rule, like a feudal noble, and every bit of "real estate" within is already bought and paid for. You can do whatever you want with the paths inside it, and you are free to use all or any or none of them, limited only by the server's technical ability to map those paths to useful things (which is not much of a limitation). Everything past the domain name is just a message to the server in a specific conventional format with an unimaginably wide range of possibilities. – Nathan Tuggy Mar 29 '17 at 7:27
  • Comments exist in the database. They each have their own ID. That ID is stuck on the end of a URL. Tada! Now you're Bill Gates. – user1228 Mar 29 '17 at 16:54
  • 1
    I'm voting to close this question as off-topic because (judging from the asker's comments under the question) it appears to actually be about how URLs, domains, and servers work at a basic level, only using SE as inspiration/example. It should probably be on Webmasters SE. – SevenSidedDie Mar 29 '17 at 18:17

From a purely technical aspect, there is essentially no additional cost to generating a permalink for every comment.

As other users have mentioned in the comments (and I will repeat), every message sent on the chat system have a specific ID number stored in the database. In fact, you can go to the Stack Exchange Data Explorer and see sort of how these values are stored. Such as to keep this conversation moving, there'll be an id field.

When you get a permalink for the comment, it's in the following format:


That ID just points to whatever record exists in the database, which is a very light query to run.

I think you might be getting confused by the "traditional" website model, where every folder and file is physical and actually present on a server's hard drive somewhere (and incurs storage fees from the likes of GoDaddy or similar).

The above idea can break down very simply with modern web applications. Instead of storing raw files and getting them as suggested by the URL, we can just pass the URL itself (transcript/message/<message_id> to the server at chat.stackoverflow.com). The web application running at the server can do whatever it wants, and return whatever it wants. In this case, Stack Exchange is using this structure to refer to objects in their database as opposed to a direct file. Basically, imagine that the URL is a variable instead of a file.

In fact, you can even demonstrate this to yourself. Someone made a cool script you can run that demonstrates how this sort of works. For example, if I make a request to localhost:8080/hello/stackexchange, the script will spit out exactly what it gets:

----- Request Start ----->

Host: localhost:8080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8

<----- Request End -----

As you can see, it really is just a meaningless variable. I can very easily write a program to return whatever I want when I hit that URL, without any backing file. In fact, it would even be possible to write a little program that will take whatever I pass in as a path, and return a string (so /hello/stackexchange becomes hello stackexchange). I'm not storing every possible word in existence. Instead, I'm generating them on-the-fly using code. Stack Exchange does the exact same thing.

Now, this doesn't mean there's no cost either. You need to store the chat message record in the database (which might be a few kilobytes -- very cheap (effectively free) in today's world). Similarly, whatever server is listening at chat.stackexchange.com must actually be running and talking to the internet and the database server (which uses bandwidth).

To give you a demonstration, I've written a Python script to do something very similar to what I mentioned above, as an example of dynamic page generation. Run it, and point your web browser to localhost:9001/hello/world to see it in action. Play around with the URLs. As you can see, there's no storage at all -- it's all dynamically generated. The only cost here is the disk space the script is taking (< 1 KB), and the bandwidth used for your computer to talk to the script (negligible at best, and in fact nonexistent because you're talking to your own computer).

In a sense, there's also a cost inasmuch as each ID is unique, and there are only so many IDs, but this can easily be fixed when the time comes.

TL;DR: It's not like storing a unique file. It's just a very light database query and storage itself to Stack Exchange is really really cheap -- on the order of a fraction of a fraction of a cent per message in the DB.

| improve this answer | |
  • and incurs storage fees from the likes of GoDaddy or similar that is exactly what my understanding is. But from your answer it appears that once a domain name is bought, all URLs under it need no extra 'buying', and can be generated on the fly corresponding to entries in a database, or such – user1993 Mar 29 '17 at 8:09
  • 1
    Basically. You can do it like GoDaddy does with a static filesystem, but you can also use what Stack Exchange and most webapps use -- which is essentially free provided you own the domain name, and the server that is hosting the content. The former is good for static content (your basic webpage), but is impossible for dynamic generation of pages if necessary. Similarly, the former requires that every URL be a full webpage. – Kaz Wolfe Mar 29 '17 at 8:11
  • the python script is magical! – user1993 Mar 29 '17 at 14:31

You seem to miss something very basic.

The permalinks are not stored anywhere. Not in memory of a computer, not on any hard disk.

They are all generated on the fly, dynamically. There is code that generates them, and showing the links you see, and there is code on the server that know to read such a permalink and send back the desired message.

| improve this answer | |
  • but isn't the URL generated from the permalink, a part of internet real estate. Can one have an infinite number of such URLs within one's domain? – user1993 Mar 29 '17 at 7:50
  • @user1993 what is "internet real estate"? When I read it on Wikipedia, I'm not sure it's what you think. Do you mean "it's taking a space/resource on the internet"? – Meta Andrew T. Mar 29 '17 at 7:51
  • @user1993 yes, the number of possible URLs is not limited. – Shadow Wizard Wearing Mask Mar 29 '17 at 7:56
  • @AndrewT., I mean that one has to pay in order to have stuff on the internet in the form of website/URL. in that way generating URL means asking for more real estate, and hence should be charged. sorry if my understanding is flawed – user1993 Mar 29 '17 at 8:00
  • 1
    @user1993 you pay for your domain (e.g., chat.stackexchange.com). Anything that exists under that domain (chat.stackexchange.com/whatAmIEvenReadingHere) doesn't cost anybody anything. It's the responsibility of the domain owner to either serve a request at that url or not. – user1228 Mar 29 '17 at 16:57

Not the answer you're looking for? Browse other questions tagged .