GithubHelp home page GithubHelp logo

tilezen / tapalcatl Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 3.0 173 KB

Tapalcatl is a "metatile server", which attempts to serve individual tiles extracted from an archive in storage.

License: Other

Go 97.64% Dockerfile 0.19% HTML 2.17%

tapalcatl's People

Contributors

dependabot[bot] avatar iandees avatar nvkelso avatar rmarianski avatar zerebubuth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tapalcatl's Issues

Build process and pegging versions

Currently it looks like we when we deploy we use the master branches of all our dependencies. We should look into pegging the versions.

Additionally, we can consider moving the binary generation to a continuous integration step, and put the resulting binary, or an rpm/deb file onto s3 and use that for deployments.

Logging and metrics

Related to #3, we'll want to be able to track whether tapalcatl was able to satisfy the request from s3 or not. If tapalcatl will continue to act as proxy for tileserver, it will need to expose this information. If not, then the fastly config should get updated accordingly.

Additionally, we should think about logging anything that might be useful to capture for metrics/analytics/alerting purposes. If it's something that we want to capture in redshift for longer term storage, it's easiest to stick the relevant information in a response header and have the fastly log parsing processes handle it.

Move server binary

The idiomatic way to do commands in Go is $PROJECT_ROOT/cmd/$COMMAND_NAME. Instead of tapalcatl_server, we should move it to cmd/tapalcatl. The change in this repo is fairly straightforward, but would also need corresponding changes in the Chef recipes.

Use dependency management

The currently fashionable way to do this is go dep. This means vendoring in the dependencies so that the tagged repo is self-contained (other than the Go compiler and runtime). This does annoyingly bloat the repo, but there doesn't seem to be much we can do about that.

Better healthcheck check

Thanks to @iandees for pointing this out yesterday.

At the moment, the healthcheck just checks that the service is up. Unfortunately, this means that when the service is working fine, but S3 isn't, the service reports an OK healthcheck while returning 5xx errors to all requests.

We could solve this in several ways, and a couple that we briefly discussed were:

  1. Check a static file on S3 when healthcheck is called. This would mean we'd need to remember to put the static file in place, but assuming it's one per bucket then that would be a infrequent. Alternatively, we could use a different API operation, such as LIST or HEAD bucket which doesn't require a static file.
  2. Passively check the rate of 5xx errors coming from S3 over the past minute(s) and if >80% of requests resulted in a 5xx, then fail the healthcheck. This seems like a good metric for failure, but passive monitoring means it'll never come back afterwards (unless we treat 0/0 as success, in which case it might ping-pong up and down when it should stay failed).

I was thinking about the second last night, but now it looks like a bad idea. What do you think, @iandees & @rmarianski?

Proxying responsibilities

At the moment, tapalcatl is responsible for reverse proxying to tileserver when s3 doesn't have the tile. Can we move this responsibility back to fastly? This should both simplify tapalcatl and leave the burden of keeping more connections open at fastly.

Be stricter when writing HTTP timestamps

The HTTP spec says:

All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone...

Tapalcatl is currently sending timestamps in RFC1123Z format, which does not exactly comply with the spec. Most servers and clients appear to be fine parsing it, but it causes a problem with Varnish, as the latter is very strict. This, in turn, causes Fastly to be unable to take advantage of "304 Not Modified" responses to If-Modified-Since conditional requests.

The Go http package provides a TimeFormat constant and says:

TimeFormat is the time format to use when generating times in HTTP headers. It is like time.RFC1123 but hard-codes GMT as the time zone. The time being formatted must be in UTC for Format to generate the correct format.

We should use the http.TimeFormat for generating times, and http.ParseTime for parsing them, to make sure we're standards-compliant and Varnish is happy.

Use a buffer pool

A buffer pool should be used as space for reading the storage zip data. To me it looks like the sized buffer pool implementation is the one we should be using. Best practice for the buffer pool implementation suggests using the 95%. We should also be logging this size.

The value of alloc should seek to provide a buffer that is representative of
most data written to the the buffer (i.e. 95th percentile) without being
overly large (which will increase static memory consumption). You may wish to
track the capacity of your last N buffers (i.e. using an []int) prior to
returning them to the pool as input into calculating a suitable alloc value.

Set up CI

Set up continuous integration to automatically run the tests.

Format json messages with newlines

Json messages with newlines aren't being formatted properly. We're currently formatting after dumping the json, we should interpolate the message first and then encode to json to ensure everything is escaped properly.

Legacy urls

Can we remove the need to send requests to tapalcatl for pre 1.0 urls? Those won't have zip files on s3 anyway. Is it possible to just have the fastly talk to s3 directly for those requests, and tapalcatl for v1+ urls?

Related to #3

Move configuration around

There are some bits of configuration that are more global in nature, but are now duplicated across each request pattern, eg the region. Let's consider decoupling this a little bit.

Config is missing?

this, as opposed to tapalcatl-py doesn't seem to have documentation on how to provide configurations

I see from the code that that I can provide a config file, but what should its structure be?

Add tilejson handling

The tilejson requests were originally handled by dispatching from fastly, but once the prefix / bucket logic moved to tapalcatl nothing was handling it any more. Since tapalcatl is aware of the prefix / bucket mapping, it makes sense to have it be responsible for serving the tilejson files.

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.