Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Pasquale Vazzana
    @Pasvaz
    no I stand corrected, classes are supported but no public/private fields, which is where it complains indeed
    Scott Clarke
    @scottswim
    yeah, safari does not like how i am doing member vars in the class.
    Pasquale Vazzana
    @Pasvaz
    yeah
    Scott Clarke
    @scottswim
    should be an easy enough fix, just have not had the time just yet.
    Pasquale Vazzana
    @Pasvaz
    I guess only babel can, there is no way to make Safari use public members apart transpiling them
    anyway, it's not a major issue, Chrome works fine
    Scott Clarke
    @scottswim
    firefox works as well.
    Pasquale Vazzana
    @Pasvaz
    not on android apparently
    Scott Clarke
    @scottswim
    oh, yeah, i am not surprised there. I have not done any optimization for mobile for flight-tracker
    that is another good thing to add to the list however.
    mobile support should be fairly easy to add.
    Scott Clarke
    @scottswim
    thanks.
    really this is where things like babel are perfect, however i am not using it in the project because i wanted to keep things as simple as possible.
    Pasquale Vazzana
    @Pasvaz
    I know what you mean
    Ajay.Gov
    @ajay-gov
    @Pasvaz thanks for pointing the issue with the flight tracker. traffic (https://github.com/swimos/traffic), transit (https://github.com/swimos/transit) work on safari and on android.
    https://traffic.swim.ai/ and https://transit.swim.ai/ are the hosted versions of those repos respectively
    Scott Clarke
    @scottswim
    flight tracker should be working better now in safari too.
    just pushed some quick fixes for safari to github and the live demo site.
    Pasquale Vazzana
    @Pasvaz
    Thanks @ajay-gov @scottswim
    Pasquale Vazzana
    @Pasvaz
    transit is quite cool and probably a better place to start
    Ajay.Gov
    @ajay-gov
    @Pasvaz thanks. Please do ping us if you have any questions.
    Peace Michaels
    @oexza

    Hi @ajay-gov

    I am a two day old swimer, so the workings of swim are not yet very clear to me. I'm exploring the possibility of using a webagent as single writer per stream in an eventstore.

    How does one co-ordinate planes in such a manner that only one instance of a webagent can exist in a "cluster" of servers, and ensure that requests are routed/re-routed to the node that has that instance running? this would be kind of like what you can achieve with Akka Cluster Sharding. Is this possible with swim?

    Ajay.Gov
    @ajay-gov
    @oexza great question and this feature is supported In swimos. The way swimos distributes webagents in a cluster is very similar to how data is distributed across a Cassandra cluster(https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/architecture/archDataDistributeDistribute.html). swimos computes a hash token for each agent's uri and the hash token is configured to a certain partition which pins agents to specific servers in the fabric. You can then address that agent using a swim client (or a browser running a swim app) by pointing the client to any plane in the fabric. Swim will transparently demultiplex links opened by external clients, and route them to the appropriate server in the fabric.
    For a concrete example on how to do this please refer to the swimos transit repo- https://github.com/swimos/transit. Specifically look at the https://github.com/swimos/transit#run-as-a-fabric section which guides you through the steps of how to setup a two server fabric. The partitions are configured in the server-a.recon and in the server-b.recon. Here we have a partition with two servers with agents being evenly distributed across both servers. Agent Uris that hash to a token that lies between 0x00000000 and 0x7fffffff are pinned to server-a and agent uris that hash to a token that lies between 0x80000000 and 0xffffffff are pinned to server-b
    Peace Michaels
    @oexza
    thanks @ajay-gov thanks, I looked at it and it seems pretty solid, the next logical question is how would you run this in a cloud environment or in kubernates where Ip Addresses are not static?
    Ajay.Gov
    @ajay-gov
    @oexza, thanks so much for checking it out! The k8s question is the next logical step indeed. Since swimos applications are stateful they need to deployed using k8s statefulsets
    The pods need to communicate internally but they can use the POD DNS names to look each other up (instead of using static IP addresses).
    External access to the k8s cluster can be made using the DNS name provided by the k8s load balancer for this cluster, swimos will then route requests to the appropriate pod internally.

    Using the transit as a concrete example, say you have the following set up in your k8s yaml file

    Service (ns/name): swimos/transit
    StatefulSet (ns/name): default/transit

    then the DNS and Hostnames will be

    StatefulSet Domain: transit.swimos.svc.cluster.local
    Pod DNS: transit-{0..N-1}.transit.swimos.svc.cluster.local
    Pod Hostname: transit-{0..N-1}

    For the 2 pod example with server-a as index 0 and server-b as index 1

    POD DNS for server-a will be: transit-0.transit.swimos.svc.cluster.local
    POD DNS for server-b will be: transit-1.transit.swimos.svc.cluster.local
    Also when running in a k8s cluster it will be best to run the app on the same port in all the pods. In order to do that change the port in @web section of the recon file. If you'd like to
    run it on port 9002 change the @web section of the recon file to be: @web(port: 9002) {

    With the apps running on port 9002, the next thing to fix is the the mesh part for the server recon.
    For server-a.recon this will be:

      @mesh {
        @part {
          key: partA
          predicate: @hash(0x00000000, 0x7fffffff)
          @host {
            primary: true
          }
    
        }
        @part {
          key: partB
          predicate: @hash(0x80000000, 0xffffffff)
          @host {
            uri: "warp://transit-1.transit.swimos.svc.cluster.local:9002"
            primary: true
          }
        }
      }

    For server-b.recon this will be:

      @mesh {
        @part {
          key: partA
          predicate: @hash(0x00000000, 0x7fffffff)
          @host {
            uri: "warp://transit-0.transit.swimos.svc.cluster.local:9002"
            primary: true
          }
        }
        @part {
          key: partB
          predicate: @hash(0x80000000, 0xffffffff)
          @host {
            primary: true
          }
        }
      }
    Ajay.Gov
    @ajay-gov
    @oexza A lot to take in, so please do let us know if you have more questions. As you can see with the current setup you will need a recon configuration file for each pod in your k8s cluster which is a tedious manual process. We are planning to add a k8s setup feature in our enterprise product swim continuum that will simplify this setup.
    Peace Michaels
    @oexza
    thanks so much for the detailed answer @ajay-gov a very lot to take in. this truly is tedious and unsustainable for on demand scaling. One thing that would really ease the pain, is a way to programatically configure the mesh instead of using the server.recon file. this is so that some kind of service discovery mechanism can be used in code instead. this kind of configuration is used alot in Apache Ignite, where discovery is so flexible to the point that even a good ol' database table can be used a registration and discovery point for the cluster. this FLEXIBILITY is HIGLY important. Would there be a way to achieve something similar today in swim?
    Ajay.Gov
    @ajay-gov
    @oexza programmatically configuring the meshes is definitely the way to go about it. The mesh configurations in the recon file is for convenience (for non-prod or single node deployments) but everything in the recon configuration file can be done programmatically. In fact we did exactly what you are asking for one of our customers where we run a multi-node k8s cluster. We can share this code with you if you'd like. Please do let us know.
    @oexza also these programmatic APIs are going to be used by our swim continuum product which will provide a UI console from which you can set up the meshes for your k8s cluster. Hopefully we will have that soon.
    Peace Michaels
    @oexza
    @ajay-gov thanks!!!. yes I'd tremendously appreciate it if you share the code with me. Thanks!
    Ajay.Gov
    @ajay-gov
    @oexza sure no problem, will do. Need to clean that code up a bit. Will have it by end of day (we are in California) if that is okay with you.
    Peace Michaels
    @oexza
    Thanks @ajay-gov I'll be waiting.
    Ajay.Gov
    @ajay-gov
    @oexza Committed the code in a branch of the transit repo. It can be found here: https://github.com/swimos/transit/tree/feature/cluster-config
    The TransitPlane class has the code that programmatically loads the mesh configurations. Please do check out this section of the readme as well
    Ajay.Gov
    @ajay-gov
    @oexza you should run it using k8s stateful sets. k8s stateful set will start up node 0 to node 5 in that order. When the TransitPlane in node 0 starts up it will try to connect to nodes 1-5 and you will see some ConnectionExceptions since those nodes aren't up yet. As the nodes come up these ConnectionExceptions will go away as the swimos kernel will try to reconnect and will eventually connect to those nodes. Usually you will see no exceptions in node 5 since nodes 0-4 would have already started up. Do let us know if you have any questions.
    Peace Michaels
    @oexza
    Thanks!!! @ajay-gov i'll test it out and give feedback.
    Dimitris Kakanis
    @itsjimos
    Hello guys, I'd like to understand more about swimos and how I can benefit from it being a full stack javascript developer
    Ajay.Gov
    @ajay-gov
    @itsjimos Hi Dimitris, swimOS is a software platform for building real-time applications. It's a self-contained vertically integrated stack, so you don't need an app server or a database or a message broker. swimOS also has UI libraries for real-time visualizations. Please refer to the docs at https://www.swimos.org/.
    Scott Clarke
    @scottswim
    Our UI libraries are javascript and integrate nicely with existing JS frameworks as well.
    Dimitris Kakanis
    @itsjimos
    My only experience with real-time applications was through socket.io for a small side project. If I'm correct swimOS is destined to a wider variety of applications like IoT.
    I lean towards web development and I'm curious of the use cases that there might be. I also see it a chance to get into DevOps. Thank you for your replies!
    Scott Clarke
    @scottswim
    on the UI side of things our Swim Client uses websockets for communication but all that is handled by our client for you. We have a number of demos, many of which have web based UIs. You can find those on our github @ https://github.com/swimos
    many of those demos have a live version as well. Some of those are:
    http://traffic.swim.ai/
    http://transit.swim.ai/
    http://swim.flights/
    http://swim.farm/
    I am a web dev as well and often build fun things with swim. My latest uses satellite data and three.js to create whats basically a pretty screensaver :D http://satellites.swim.ai/neon.html
    Scott Clarke
    @scottswim
    Swim also can act as a web server and is very easy to setup. This way you can easy fire up a web server if you dont have one already.
    Dimitris Kakanis
    @itsjimos
    Yea, these demos look great. I remembered that a couple of years ago I had some time with InfluxDB a time series database. To my eyes its philosophy is close to real time application technologies and therefore Swim. I will look at the docs and experiment a bit the following weeks. Keep it up!
    Scott Clarke
    @scottswim
    Awesome. let us know if you have questions or get stuck. We are here to help!